@ManagedResource(description="Managed CamelReactiveStreamsService") public class DefaultCamelReactiveStreamsService extends org.apache.camel.support.ServiceSupport implements CamelReactiveStreamsService
Constructor and Description |
---|
DefaultCamelReactiveStreamsService(org.apache.camel.CamelContext context,
ReactiveStreamsEngineConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
ReactiveStreamsCamelSubscriber |
attachCamelConsumer(String name,
ReactiveStreamsConsumer consumer)
Used by Camel to associate the subscriber of the stream with the given name to a specific Camel consumer.
|
void |
attachCamelProducer(String name,
ReactiveStreamsProducer producer)
Used by Camel to associate the publisher of the stream with the given name to a specific Camel producer.
|
TabularData |
camelPublishers() |
TabularData |
camelSubscribers() |
void |
detachCamelConsumer(String name)
Used by Camel to detach the existing consumer from the given stream.
|
void |
detachCamelProducer(String name)
Used by Camel to detach the existing producer from the given stream.
|
protected org.reactivestreams.Publisher<org.apache.camel.Exchange> |
doRequest(String name,
org.apache.camel.Exchange data) |
protected void |
doStart() |
protected void |
doStop() |
org.reactivestreams.Publisher<org.apache.camel.Exchange> |
from(String uri)
Creates a new stream from the endpoint URI (used as Camel Consumer) and returns
the associated
Publisher . |
<T> org.reactivestreams.Publisher<T> |
from(String uri,
Class<T> type)
Creates a new stream of the given type from the endpoint URI (used as Camel Consumer) and returns
the associated
Publisher . |
org.reactivestreams.Publisher<org.apache.camel.Exchange> |
fromStream(String name)
Returns the publisher associated to the given stream name.
|
<T> org.reactivestreams.Publisher<T> |
fromStream(String name,
Class<T> cls)
Returns the publisher associated to the given stream name.
|
String |
getId() |
<T> void |
process(String uri,
Class<T> type,
Function<? super org.reactivestreams.Publisher<T>,?> processor)
Adds a processing step at the specified endpoint uri (usually a "direct:name") that delegates
to the given reactive processor.
|
void |
process(String uri,
Function<? super org.reactivestreams.Publisher<org.apache.camel.Exchange>,?> processor)
Adds a processing step at the specified endpoint uri (usually a "direct:name") that delegates
to the given reactive processor.
|
void |
sendCamelExchange(String name,
org.apache.camel.Exchange exchange)
Used by Camel to send the exchange to all active subscriptions on the given stream.
|
ReactiveStreamsCamelSubscriber |
streamSubscriber(String name)
Returns the subscriber associated to the given stream name.
|
<T> org.reactivestreams.Subscriber<T> |
streamSubscriber(String name,
Class<T> type)
Returns the subscriber associated to the given stream name.
|
org.reactivestreams.Subscriber<org.apache.camel.Exchange> |
subscriber(String uri)
Creates a new route that pushes data to the endpoint URI and returns
the associated
Subscriber . |
<T> org.reactivestreams.Subscriber<T> |
subscriber(String uri,
Class<T> type)
Creates a new route that pushes data to the endpoint URI and returns
the associated
Subscriber . |
Function<Object,org.reactivestreams.Publisher<org.apache.camel.Exchange>> |
to(String uri)
Creates a new route that uses the endpoint URI as producer, and returns a
function that pushes the data into the route and returns the
Publisher that holds the resulting exchange or the error. |
<T> Function<Object,org.reactivestreams.Publisher<T>> |
to(String uri,
Class<T> type)
Creates a new route that uses the endpoint URI as producer, and returns a
function that pushes the data into the route and returns the
Publisher that holds the exchange output or an error. |
org.reactivestreams.Publisher<org.apache.camel.Exchange> |
to(String uri,
Object data)
Creates a new route that uses the endpoint URI as producer, pushes the given data to the route
and returns a
Publisher that will eventually return the resulting exchange or an error. |
<T> org.reactivestreams.Publisher<T> |
to(String uri,
Object data,
Class<T> type)
Creates a new route that uses the endpoint URI as producer, pushes the given data to the route
and returns a
Publisher that will eventually return the exchange output or an error. |
Function<?,? extends org.reactivestreams.Publisher<org.apache.camel.Exchange>> |
toStream(String name)
Returns a function that pushes data into the specified Camel stream and
returns a Publisher (mono) holding the resulting exchange or an error.
|
<T> Function<Object,org.reactivestreams.Publisher<T>> |
toStream(String name,
Class<T> type)
Returns a function that pushes data into the specified Camel stream and
returns a Publisher (mono) holding the exchange output or an error.
|
org.reactivestreams.Publisher<org.apache.camel.Exchange> |
toStream(String name,
Object data)
Pushes the given data into the specified Camel stream and returns a Publisher (mono) holding
the resulting exchange or an error.
|
<T> org.reactivestreams.Publisher<T> |
toStream(String name,
Object data,
Class<T> type)
Pushes the given data into the specified Camel stream and returns a Publisher (mono) holding
the exchange output or an error.
|
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public DefaultCamelReactiveStreamsService(org.apache.camel.CamelContext context, ReactiveStreamsEngineConfiguration configuration)
public String getId()
getId
in interface org.apache.camel.spi.HasId
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class org.apache.camel.support.ServiceSupport
Exception
public org.reactivestreams.Publisher<org.apache.camel.Exchange> fromStream(String name)
CamelReactiveStreamsService
fromStream
in interface CamelReactiveStreamsService
name
- the stream namepublic <T> org.reactivestreams.Publisher<T> fromStream(String name, Class<T> cls)
CamelReactiveStreamsService
fromStream
in interface CamelReactiveStreamsService
T
- the type of items emitted by the publishername
- the stream namecls
- the type of the emitted itemspublic ReactiveStreamsCamelSubscriber streamSubscriber(String name)
CamelReactiveStreamsService
streamSubscriber
in interface CamelReactiveStreamsService
name
- the stream namepublic <T> org.reactivestreams.Subscriber<T> streamSubscriber(String name, Class<T> type)
CamelReactiveStreamsService
streamSubscriber
in interface CamelReactiveStreamsService
T
- the type of items accepted by the subscribername
- the stream nametype
- the publisher converts automatically exchanges to the given type.public void sendCamelExchange(String name, org.apache.camel.Exchange exchange)
CamelReactiveStreamsService
sendCamelExchange
in interface CamelReactiveStreamsService
name
- the stream nameexchange
- the exchange to be forwarded to the external subscriberspublic org.reactivestreams.Publisher<org.apache.camel.Exchange> toStream(String name, Object data)
CamelReactiveStreamsService
toStream
in interface CamelReactiveStreamsService
name
- the stream namedata
- the data to pushpublic Function<?,? extends org.reactivestreams.Publisher<org.apache.camel.Exchange>> toStream(String name)
CamelReactiveStreamsService
CamelReactiveStreamsService.toStream(String, Object)
.toStream
in interface CamelReactiveStreamsService
name
- the stream namepublic <T> org.reactivestreams.Publisher<T> toStream(String name, Object data, Class<T> type)
CamelReactiveStreamsService
toStream
in interface CamelReactiveStreamsService
T
- the generic type of the resulting Publishername
- the stream namedata
- the data to pushtype
- the type to which the output should be convertedprotected org.reactivestreams.Publisher<org.apache.camel.Exchange> doRequest(String name, org.apache.camel.Exchange data)
public <T> Function<Object,org.reactivestreams.Publisher<T>> toStream(String name, Class<T> type)
CamelReactiveStreamsService
CamelReactiveStreamsService.toStream(String, Object, Class)
.toStream
in interface CamelReactiveStreamsService
T
- the generic type of the resulting Publishername
- the stream nametype
- the type to which the output should be convertedpublic org.reactivestreams.Publisher<org.apache.camel.Exchange> from(String uri)
CamelReactiveStreamsService
Publisher
.
If a stream has already been created, the existing Publisher
is returned.from
in interface CamelReactiveStreamsService
uri
- the consumer uripublic <T> org.reactivestreams.Publisher<T> from(String uri, Class<T> type)
CamelReactiveStreamsService
Publisher
.
If a stream has already been created, the existing Publisher
is returned.from
in interface CamelReactiveStreamsService
T
- the type to which Camel should convert exchanges touri
- the consumer uritype
- the type of items emitted by the publisherpublic org.reactivestreams.Subscriber<org.apache.camel.Exchange> subscriber(String uri)
CamelReactiveStreamsService
Subscriber
.
This method always create a new stream.subscriber
in interface CamelReactiveStreamsService
uri
- the target uripublic <T> org.reactivestreams.Subscriber<T> subscriber(String uri, Class<T> type)
CamelReactiveStreamsService
Subscriber
.
This method always create a new stream.subscriber
in interface CamelReactiveStreamsService
T
- the type from which Camel should convert data to exchangesuri
- the target uritype
- the type of items that the subscriber can receivepublic org.reactivestreams.Publisher<org.apache.camel.Exchange> to(String uri, Object data)
CamelReactiveStreamsService
Publisher
that will eventually return the resulting exchange or an error.to
in interface CamelReactiveStreamsService
uri
- the producer uridata
- the data to pushpublic Function<Object,org.reactivestreams.Publisher<org.apache.camel.Exchange>> to(String uri)
CamelReactiveStreamsService
Publisher
that holds the resulting exchange or the error.
This is a curryied version of CamelReactiveStreamsService.to(String, Object)
.to
in interface CamelReactiveStreamsService
uri
- the producer uripublic <T> org.reactivestreams.Publisher<T> to(String uri, Object data, Class<T> type)
CamelReactiveStreamsService
Publisher
that will eventually return the exchange output or an error.to
in interface CamelReactiveStreamsService
T
- the generic type of the resulting Publisheruri
- the producer uridata
- the data to pushtype
- the type to which the output should be convertedpublic <T> Function<Object,org.reactivestreams.Publisher<T>> to(String uri, Class<T> type)
CamelReactiveStreamsService
Publisher
that holds the exchange output or an error.
This is a curryied version of CamelReactiveStreamsService.to(String, Object, Class)
.to
in interface CamelReactiveStreamsService
T
- the generic type of the resulting Publisheruri
- the producer uritype
- the type to which the output should be convertedpublic void process(String uri, Function<? super org.reactivestreams.Publisher<org.apache.camel.Exchange>,?> processor)
CamelReactiveStreamsService
Publisher
of exchanges and returns an object.
If the output of the processor is a Publisher
, it will be unwrapped before
delivering the result to the source route.process
in interface CamelReactiveStreamsService
uri
- the uri where the processor should be attachedprocessor
- the reactive processorpublic <T> void process(String uri, Class<T> type, Function<? super org.reactivestreams.Publisher<T>,?> processor)
CamelReactiveStreamsService
Publisher
of items of the given type and returns an object.
If the output of the processor is a Publisher
, it will be unwrapped before
delivering the result to the source route.process
in interface CamelReactiveStreamsService
T
- the generic type of the Publisher that should be processeduri
- the uri where the processor should be attachedtype
- the type to which the body of the exchange should be convertedprocessor
- the reactive processorpublic ReactiveStreamsCamelSubscriber attachCamelConsumer(String name, ReactiveStreamsConsumer consumer)
CamelReactiveStreamsService
attachCamelConsumer
in interface CamelReactiveStreamsService
name
- the stream nameconsumer
- the consumer of the routepublic void detachCamelConsumer(String name)
CamelReactiveStreamsService
detachCamelConsumer
in interface CamelReactiveStreamsService
name
- the stream namepublic void attachCamelProducer(String name, ReactiveStreamsProducer producer)
CamelReactiveStreamsService
attachCamelProducer
in interface CamelReactiveStreamsService
name
- the stream nameproducer
- the producer of the routepublic void detachCamelProducer(String name)
CamelReactiveStreamsService
detachCamelProducer
in interface CamelReactiveStreamsService
name
- the stream name@ManagedOperation(description="Information about Camel Reactive subscribers") public TabularData camelSubscribers()
@ManagedOperation(description="Information about Camel Reactive publishers") public TabularData camelPublishers()
Apache Camel