public interface ProducerCache extends Service
Producer
.Modifier and Type | Interface and Description |
---|---|
static interface |
ProducerCache.AsyncProducerCallback
Callback for sending a exchange message to a endpoint using an
AsyncProcessor capable producer. |
Modifier and Type | Method and Description |
---|---|
AsyncProducer |
acquireProducer(Endpoint endpoint)
Acquires a pooled producer which you must release back again after usage using the
releaseProducer(org.apache.camel.Endpoint, org.apache.camel.AsyncProducer) method. |
CompletableFuture<Exchange> |
asyncSendExchange(Endpoint endpoint,
ExchangePattern pattern,
Processor processor,
Processor resultProcessor,
Exchange exchange,
CompletableFuture<Exchange> future)
Asynchronously sends an exchange to an endpoint using a supplied
Processor to populate the exchange |
void |
cleanUp()
Cleanup the cache (purging stale entries)
|
boolean |
doInAsyncProducer(Endpoint endpoint,
Exchange exchange,
AsyncCallback callback,
ProducerCache.AsyncProducerCallback producerCallback)
Sends an exchange to an endpoint using a supplied callback supporting the asynchronous routing engine.
|
int |
getCapacity()
Gets the maximum cache size (capacity).
|
EndpointUtilizationStatistics |
getEndpointUtilizationStatistics()
Gets the endpoint statistics
|
Object |
getSource()
Gets the source which uses this cache
|
boolean |
isEventNotifierEnabled()
Whether
EventNotifier is enabled |
void |
purge()
Purges this cache
|
void |
releaseProducer(Endpoint endpoint,
AsyncProducer producer)
Releases an acquired producer back after usage.
|
Exchange |
send(Endpoint endpoint,
Exchange exchange,
Processor resultProcessor)
Sends the exchange to the given endpoint.
|
void |
setEventNotifierEnabled(boolean eventNotifierEnabled)
Sets whether
EventNotifier is enabled |
int |
size()
Returns the current size of the cache
|
AsyncProducer acquireProducer(Endpoint endpoint)
releaseProducer(org.apache.camel.Endpoint, org.apache.camel.AsyncProducer)
method.
If the producer is currently starting then the cache will wait at most 30 seconds for the producer to finish
starting and be ready for use.endpoint
- the endpointvoid releaseProducer(Endpoint endpoint, AsyncProducer producer)
endpoint
- the endpointproducer
- the producer to releaseExchange send(Endpoint endpoint, Exchange exchange, Processor resultProcessor)
This method will not throw an exception. If processing of the given Exchange failed then the exception is stored on the provided Exchange
endpoint
- the endpoint to send the exchange toexchange
- the exchange to sendRejectedExecutionException
- is thrown if CamelContext is stoppedCompletableFuture<Exchange> asyncSendExchange(Endpoint endpoint, ExchangePattern pattern, Processor processor, Processor resultProcessor, Exchange exchange, CompletableFuture<Exchange> future)
Processor
to populate the exchange
This method will neither throw an exception nor complete future exceptionally. If processing of the given Exchange failed then the exception is stored on the return Exchange
endpoint
- the endpoint to send the exchange topattern
- the message ExchangePattern
such as ExchangePattern.InOnly
or
ExchangePattern.InOut
processor
- the transformer used to populate the new exchangeresultProcessor
- a processor to process the exchange when the send is complete.exchange
- an exchange to use in processing. Exchange will be created if parameter is null.future
- the preexisting future to complete when processing is done or null if to create new oneObject getSource()
int size()
int getCapacity()
void purge()
void cleanUp()
boolean isEventNotifierEnabled()
EventNotifier
is enabledvoid setEventNotifierEnabled(boolean eventNotifierEnabled)
EventNotifier
is enabledEndpointUtilizationStatistics getEndpointUtilizationStatistics()
boolean doInAsyncProducer(Endpoint endpoint, Exchange exchange, AsyncCallback callback, ProducerCache.AsyncProducerCallback producerCallback)
endpoint
- the endpoint to send the exchange toexchange
- the exchange, can be null if so then create a new exchange from the producercallback
- the asynchronous callbackproducerCallback
- the producer template callback to be executedApache Camel