|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.impl.ServiceSupport
org.apache.camel.impl.ProducerCache
public class ProducerCache
Cache containing created Producer
.
Constructor Summary | |
---|---|
ProducerCache(Object source,
CamelContext camelContext)
|
|
ProducerCache(Object source,
CamelContext camelContext,
int cacheSize)
|
|
ProducerCache(Object source,
CamelContext camelContext,
ServicePool<Endpoint,Producer> producerServicePool,
Map<String,Producer> cache)
|
Method Summary | ||
---|---|---|
Producer |
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.Producer) method. |
|
protected Producer |
doGetProducer(Endpoint endpoint,
boolean pooled)
|
|
boolean |
doInAsyncProducer(Endpoint endpoint,
Exchange exchange,
ExchangePattern pattern,
AsyncCallback callback,
AsyncProducerCallback producerCallback)
Sends an exchange to an endpoint using a supplied callback supporting the asynchronous routing engine. |
|
|
doInProducer(Endpoint endpoint,
Exchange exchange,
ExchangePattern pattern,
ProducerCallback<T> callback)
Sends an exchange to an endpoint using a supplied callback If an exception was thrown during processing, it would be set on the given Exchange |
|
protected void |
doStart()
|
|
protected void |
doStop()
|
|
CamelContext |
getCamelContext()
|
|
int |
getCapacity()
Gets the maximum cache size (capacity). |
|
Object |
getSource()
Gets the source which uses this cache |
|
void |
releaseProducer(Endpoint endpoint,
Producer producer)
Releases an acquired producer back after usage. |
|
void |
send(Endpoint endpoint,
Exchange exchange)
Sends the exchange to the given endpoint. |
|
Exchange |
send(Endpoint endpoint,
ExchangePattern pattern,
Processor processor)
Sends an exchange to an endpoint using a supplied Processor to populate the exchange |
|
Exchange |
send(Endpoint endpoint,
Processor processor)
Sends an exchange to an endpoint using a supplied Processor to populate the exchange |
|
protected Exchange |
sendExchange(Endpoint endpoint,
ExchangePattern pattern,
Processor processor,
Exchange exchange)
|
|
int |
size()
Returns the current size of the cache |
|
void |
startProducer(Endpoint endpoint)
Starts the Producer to be used for sending to the given endpoint
This can be used to early start the Producer to ensure it can be created,
such as when Camel is started. |
|
String |
toString()
|
Methods inherited from class org.apache.camel.impl.ServiceSupport |
---|
addChildService, doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, start, stop, suspend |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ProducerCache(Object source, CamelContext camelContext)
public ProducerCache(Object source, CamelContext camelContext, int cacheSize)
public ProducerCache(Object source, CamelContext camelContext, ServicePool<Endpoint,Producer> producerServicePool, Map<String,Producer> cache)
Method Detail |
---|
public CamelContext getCamelContext()
public Object getSource()
public Producer acquireProducer(Endpoint endpoint)
releaseProducer(org.apache.camel.Endpoint, org.apache.camel.Producer)
method.
endpoint
- the endpoint
public void releaseProducer(Endpoint endpoint, Producer producer) throws Exception
endpoint
- the endpointproducer
- the producer to release
Exception
- can be thrown if error stopping producer if that was needed.public void startProducer(Endpoint endpoint) throws Exception
Producer
to be used for sending to the given endpoint
This can be used to early start the Producer
to ensure it can be created,
such as when Camel is started. This allows to fail fast in case the Producer
could not be started.
endpoint
- the endpoint to send the exchange to
Exception
- is thrown if failed to create or start the Producer
public void send(Endpoint endpoint, Exchange exchange)
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 sendpublic Exchange send(Endpoint endpoint, Processor processor)
Processor
to populate the exchange
This method will not throw an exception. If processing of the given Exchange failed then the exception is stored on the return Exchange
endpoint
- the endpoint to send the exchange toprocessor
- the transformer used to populate the new exchange
CamelExecutionException
- is thrown if sending failedpublic Exchange send(Endpoint endpoint, ExchangePattern pattern, Processor processor)
Processor
to populate the exchange
This method will not throw an exception. 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 exchange
public <T> T doInProducer(Endpoint endpoint, Exchange exchange, ExchangePattern pattern, ProducerCallback<T> callback)
endpoint
- the endpoint to send the exchange toexchange
- the exchange, can be null if so then create a new exchange from the producerpattern
- the exchange pattern, can be nullcallback
- the callback
public boolean doInAsyncProducer(Endpoint endpoint, Exchange exchange, ExchangePattern pattern, AsyncCallback callback, AsyncProducerCallback producerCallback)
endpoint
- the endpoint to send the exchange toexchange
- the exchange, can be null if so then create a new exchange from the producerpattern
- the exchange pattern, can be nullcallback
- the asynchronous callbackproducerCallback
- the producer template callback to be executed
protected Exchange sendExchange(Endpoint endpoint, ExchangePattern pattern, Processor processor, Exchange exchange)
protected Producer doGetProducer(Endpoint endpoint, boolean pooled)
protected void doStop() throws Exception
doStop
in class ServiceSupport
Exception
protected void doStart() throws Exception
doStart
in class ServiceSupport
Exception
public int size()
public int getCapacity()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |