public class DefaultProducerCache extends org.apache.camel.support.service.ServiceSupport implements org.apache.camel.spi.ProducerCache
Producer
.Constructor and Description |
---|
DefaultProducerCache(Object source,
org.apache.camel.CamelContext camelContext,
int cacheSize) |
Modifier and Type | Method and Description |
---|---|
org.apache.camel.AsyncProducer |
acquireProducer(org.apache.camel.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. |
protected boolean |
asyncDispatchExchange(org.apache.camel.Endpoint endpoint,
org.apache.camel.AsyncProducer producer,
org.apache.camel.Processor resultProcessor,
org.apache.camel.Exchange exchange,
org.apache.camel.AsyncCallback callback) |
CompletableFuture<org.apache.camel.Exchange> |
asyncSend(org.apache.camel.Endpoint endpoint,
org.apache.camel.ExchangePattern pattern,
org.apache.camel.Processor processor,
org.apache.camel.Processor resultProcessor,
CompletableFuture<org.apache.camel.Exchange> future)
Asynchronously sends an exchange to an endpoint using a supplied
Processor to populate the exchange |
CompletableFuture<org.apache.camel.Exchange> |
asyncSendExchange(org.apache.camel.Endpoint endpoint,
org.apache.camel.ExchangePattern pattern,
org.apache.camel.Processor processor,
org.apache.camel.Processor resultProcessor,
org.apache.camel.Exchange exchange,
CompletableFuture<org.apache.camel.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)
|
protected CompletableFuture<org.apache.camel.Exchange> |
doAsyncSendExchange(org.apache.camel.Endpoint endpoint,
org.apache.camel.Processor processor,
org.apache.camel.Processor resultProcessor,
org.apache.camel.Exchange exchange,
CompletableFuture<org.apache.camel.Exchange> f) |
protected org.apache.camel.AsyncProducer |
doGetProducer(org.apache.camel.Endpoint endpoint) |
boolean |
doInAsyncProducer(org.apache.camel.Endpoint endpoint,
org.apache.camel.Exchange exchange,
org.apache.camel.AsyncCallback callback,
org.apache.camel.spi.ProducerCache.AsyncProducerCallback producerCallback)
Sends an exchange to an endpoint using a supplied callback supporting the asynchronous routing engine.
|
protected void |
doStart() |
protected void |
doStop() |
org.apache.camel.CamelContext |
getCamelContext() |
int |
getCapacity()
Gets the maximum cache size (capacity).
|
org.apache.camel.spi.EndpointUtilizationStatistics |
getEndpointUtilizationStatistics() |
long |
getEvicted()
Gets the cache evicted statistic
Will return -1 if it cannot determine this if a custom cache was used.
|
long |
getHits()
Gets the cache hits statistic
Will return -1 if it cannot determine this if a custom cache was used.
|
long |
getMisses()
Gets the cache misses statistic
Will return -1 if it cannot determine this if a custom cache was used.
|
Object |
getSource()
Gets the source which uses this cache
|
boolean |
isEventNotifierEnabled() |
boolean |
isExtendedStatistics() |
void |
purge()
Purges this cache
|
void |
releaseProducer(org.apache.camel.Endpoint endpoint,
org.apache.camel.AsyncProducer producer)
Releases an acquired producer back after usage.
|
void |
resetCacheStatistics()
Resets the cache statistics
|
org.apache.camel.Exchange |
send(org.apache.camel.Endpoint endpoint,
org.apache.camel.Exchange exchange,
org.apache.camel.Processor resultProcessor)
Sends the exchange to the given endpoint.
|
void |
setEventNotifierEnabled(boolean eventNotifierEnabled)
Whether
EventNotifier is enabled |
void |
setExtendedStatistics(boolean extendedStatistics)
Whether extended JMX statistics is enabled for
EndpointUtilizationStatistics |
int |
size()
Returns the current size of the cache
|
String |
toString() |
doInit, doResume, doShutdown, doSuspend, getStatus, init, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public DefaultProducerCache(Object source, org.apache.camel.CamelContext camelContext, int cacheSize)
public boolean isEventNotifierEnabled()
isEventNotifierEnabled
in interface org.apache.camel.spi.ProducerCache
public void setEventNotifierEnabled(boolean eventNotifierEnabled)
EventNotifier
is enabledsetEventNotifierEnabled
in interface org.apache.camel.spi.ProducerCache
public boolean isExtendedStatistics()
public void setExtendedStatistics(boolean extendedStatistics)
EndpointUtilizationStatistics
public org.apache.camel.CamelContext getCamelContext()
public Object getSource()
getSource
in interface org.apache.camel.spi.ProducerCache
public org.apache.camel.AsyncProducer acquireProducer(org.apache.camel.Endpoint endpoint)
releaseProducer(org.apache.camel.Endpoint, org.apache.camel.AsyncProducer)
method.acquireProducer
in interface org.apache.camel.spi.ProducerCache
endpoint
- the endpointpublic void releaseProducer(org.apache.camel.Endpoint endpoint, org.apache.camel.AsyncProducer producer)
releaseProducer
in interface org.apache.camel.spi.ProducerCache
endpoint
- the endpointproducer
- the producer to releasepublic org.apache.camel.Exchange send(org.apache.camel.Endpoint endpoint, org.apache.camel.Exchange exchange, org.apache.camel.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
send
in interface org.apache.camel.spi.ProducerCache
endpoint
- the endpoint to send the exchange toexchange
- the exchange to sendpublic CompletableFuture<org.apache.camel.Exchange> asyncSend(org.apache.camel.Endpoint endpoint, org.apache.camel.ExchangePattern pattern, org.apache.camel.Processor processor, org.apache.camel.Processor resultProcessor, CompletableFuture<org.apache.camel.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.future
- the preexisting future to complete when processing is done or null if to create new onepublic CompletableFuture<org.apache.camel.Exchange> asyncSendExchange(org.apache.camel.Endpoint endpoint, org.apache.camel.ExchangePattern pattern, org.apache.camel.Processor processor, org.apache.camel.Processor resultProcessor, org.apache.camel.Exchange exchange, CompletableFuture<org.apache.camel.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
asyncSendExchange
in interface org.apache.camel.spi.ProducerCache
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 oneprotected CompletableFuture<org.apache.camel.Exchange> doAsyncSendExchange(org.apache.camel.Endpoint endpoint, org.apache.camel.Processor processor, org.apache.camel.Processor resultProcessor, org.apache.camel.Exchange exchange, CompletableFuture<org.apache.camel.Exchange> f)
public boolean doInAsyncProducer(org.apache.camel.Endpoint endpoint, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback, org.apache.camel.spi.ProducerCache.AsyncProducerCallback producerCallback)
doInAsyncProducer
in interface org.apache.camel.spi.ProducerCache
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 executedprotected boolean asyncDispatchExchange(org.apache.camel.Endpoint endpoint, org.apache.camel.AsyncProducer producer, org.apache.camel.Processor resultProcessor, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback)
protected org.apache.camel.AsyncProducer doGetProducer(org.apache.camel.Endpoint endpoint) throws Exception
Exception
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.service.ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class org.apache.camel.support.service.ServiceSupport
Exception
public int size()
size
in interface org.apache.camel.spi.ProducerCache
public int getCapacity()
getCapacity
in interface org.apache.camel.spi.ProducerCache
public long getHits()
getHits
in interface org.apache.camel.spi.ProducerCache
public long getMisses()
getMisses
in interface org.apache.camel.spi.ProducerCache
public long getEvicted()
getEvicted
in interface org.apache.camel.spi.ProducerCache
public void resetCacheStatistics()
resetCacheStatistics
in interface org.apache.camel.spi.ProducerCache
public void purge()
purge
in interface org.apache.camel.spi.ProducerCache
public void cleanUp()
cleanUp
in interface org.apache.camel.spi.ProducerCache
public org.apache.camel.spi.EndpointUtilizationStatistics getEndpointUtilizationStatistics()
getEndpointUtilizationStatistics
in interface org.apache.camel.spi.ProducerCache
Apache Camel