org.apache.camel.impl
Class DefaultProducerTemplate

java.lang.Object
  extended by org.apache.camel.support.ServiceSupport
      extended by org.apache.camel.impl.DefaultProducerTemplate
All Implemented Interfaces:
ProducerTemplate, Service, ShutdownableService, StatefulService, SuspendableService

public class DefaultProducerTemplate
extends ServiceSupport
implements ProducerTemplate

Template (named like Spring's TransactionTemplate & JmsTemplate et al) for working with Camel and sending Message instances in an Exchange to an Endpoint.

Version:

Field Summary
 
Fields inherited from class org.apache.camel.support.ServiceSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
 
Constructor Summary
DefaultProducerTemplate(CamelContext context)
           
DefaultProducerTemplate(CamelContext context, Endpoint defaultEndpoint)
           
DefaultProducerTemplate(CamelContext context, ExecutorService executor)
           
 
Method Summary
 Future<Exchange> asyncCallback(Endpoint endpoint, Exchange exchange, Synchronization onCompletion)
          Sends an asynchronous exchange to the given endpoint.
 Future<Exchange> asyncCallback(Endpoint endpoint, Processor processor, Synchronization onCompletion)
          Sends an asynchronous exchange to the given endpoint using a supplied processor.
 Future<Exchange> asyncCallback(String uri, Exchange exchange, Synchronization onCompletion)
          Sends an asynchronous exchange to the given endpoint.
 Future<Exchange> asyncCallback(String uri, Processor processor, Synchronization onCompletion)
          Sends an asynchronous exchange to the given endpoint using a supplied processor.
 Future<Object> asyncCallbackRequestBody(Endpoint endpoint, Object body, Synchronization onCompletion)
          Sends an asynchronous body to the given endpoint.
 Future<Object> asyncCallbackRequestBody(String uri, Object body, Synchronization onCompletion)
          Sends an asynchronous body to the given endpoint.
 Future<Object> asyncCallbackSendBody(Endpoint endpoint, Object body, Synchronization onCompletion)
          Sends an asynchronous body to the given endpoint.
 Future<Object> asyncCallbackSendBody(String uri, Object body, Synchronization onCompletion)
          Sends an asynchronous body to the given endpoint.
 Future<Object> asyncRequestBody(Endpoint endpoint, Object body)
          Sends an asynchronous body to the given endpoint.
<T> Future<T>
asyncRequestBody(Endpoint endpoint, Object body, Class<T> type)
          Sends an asynchronous body to the given endpoint.
 Future<Object> asyncRequestBody(String uri, Object body)
          Sends an asynchronous body to the given endpoint.
<T> Future<T>
asyncRequestBody(String uri, Object body, Class<T> type)
          Sends an asynchronous body to the given endpoint.
 Future<Object> asyncRequestBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue)
          Sends an asynchronous body to the given endpoint.
<T> Future<T>
asyncRequestBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue, Class<T> type)
          Sends an asynchronous body to the given endpoint.
 Future<Object> asyncRequestBodyAndHeader(String endpointUri, Object body, String header, Object headerValue)
          Sends an asynchronous body to the given endpoint.
<T> Future<T>
asyncRequestBodyAndHeader(String endpointUri, Object body, String header, Object headerValue, Class<T> type)
          Sends an asynchronous body to the given endpoint.
 Future<Object> asyncRequestBodyAndHeaders(Endpoint endpoint, Object body, Map<String,Object> headers)
          Sends an asynchronous body to the given endpoint.
<T> Future<T>
asyncRequestBodyAndHeaders(Endpoint endpoint, Object body, Map<String,Object> headers, Class<T> type)
          Sends an asynchronous body to the given endpoint.
 Future<Object> asyncRequestBodyAndHeaders(String endpointUri, Object body, Map<String,Object> headers)
          Sends an asynchronous body to the given endpoint.
<T> Future<T>
asyncRequestBodyAndHeaders(String endpointUri, Object body, Map<String,Object> headers, Class<T> type)
          Sends an asynchronous body to the given endpoint.
 Future<Exchange> asyncSend(Endpoint endpoint, Exchange exchange)
          Sends an asynchronous exchange to the given endpoint.
 Future<Exchange> asyncSend(Endpoint endpoint, Processor processor)
          Sends an asynchronous exchange to the given endpoint.
 Future<Exchange> asyncSend(String uri, Exchange exchange)
          Sends an asynchronous exchange to the given endpoint.
 Future<Exchange> asyncSend(String uri, Processor processor)
          Sends an asynchronous exchange to the given endpoint.
 Future<Object> asyncSendBody(Endpoint endpoint, Object body)
          Sends an asynchronous body to the given endpoint.
 Future<Object> asyncSendBody(String uri, Object body)
          Sends an asynchronous body to the given endpoint.
protected  Processor createBodyAndHeaderProcessor(Object body, String header, Object headerValue)
           
protected  Processor createBodyAndPropertyProcessor(Object body, String property, Object propertyValue)
           
protected  Processor createSetBodyProcessor(Object body)
           
protected  void doStart()
          Implementations override this method to support customized start/stop.
protected  void doStop()
          Implementations override this method to support customized start/stop.
<T> T
extractFutureBody(Future<Object> future, Class<T> type)
          Gets the response body from the future handle, will wait until the response is ready.
<T> T
extractFutureBody(Future<Object> future, long timeout, TimeUnit unit, Class<T> type)
          Gets the response body from the future handle, will wait at most the given time for the response to be ready.
protected  Object extractResultBody(Exchange result)
           
protected  Object extractResultBody(Exchange result, ExchangePattern pattern)
           
 CamelContext getContext()
           
 int getCurrentCacheSize()
          Gets an approximated size of the current cached resources in the backing cache pools.
 Endpoint getDefaultEndpoint()
          Get the default endpoint to use if none is specified
protected  Endpoint getMandatoryDefaultEndpoint()
           
 int getMaximumCacheSize()
          Gets the maximum cache size used in the backing cache pools.
<T extends Endpoint>
T
getResolvedEndpoint(String endpointUri, Class<T> expectedClass)
           
static DefaultProducerTemplate newInstance(CamelContext camelContext, String defaultEndpointUri)
           
 Exchange request(Endpoint endpoint, Processor processor)
          Sends an exchange to an endpoint using a supplied processor Uses an ExchangePattern.InOut message exchange pattern.
 Exchange request(String endpoint, Processor processor)
          Sends an exchange to an endpoint using a supplied processor Uses an ExchangePattern.InOut message exchange pattern.
 Object requestBody(Endpoint endpoint, Object body)
          Send the body to an endpoint returning any result output body.
<T> T
requestBody(Endpoint endpoint, Object body, Class<T> type)
          Send the body to an endpoint returning any result output body.
 Object requestBody(Object body)
          Sends the body to the default endpoint and returns the result content Uses an ExchangePattern.InOut message exchange pattern.
<T> T
requestBody(Object body, Class<T> type)
          Sends the body to the default endpoint and returns the result content Uses an ExchangePattern.InOut message exchange pattern.
 Object requestBody(String endpoint, Object body)
          Send the body to an endpoint returning any result output body.
<T> T
requestBody(String endpointUri, Object body, Class<T> type)
          Send the body to an endpoint returning any result output body.
 Object requestBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue)
          Send the body to an endpoint returning any result output body.
<T> T
requestBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue, Class<T> type)
          Send the body to an endpoint returning any result output body.
 Object requestBodyAndHeader(Object body, String header, Object headerValue)
          Sends the body to the default endpoint and returns the result content Uses an ExchangePattern.InOut message exchange pattern.
 Object requestBodyAndHeader(String endpoint, Object body, String header, Object headerValue)
          Send the body to an endpoint returning any result output body.
<T> T
requestBodyAndHeader(String endpointUri, Object body, String header, Object headerValue, Class<T> type)
          Send the body to an endpoint returning any result output body.
 Object requestBodyAndHeaders(Endpoint endpoint, Object body, Map<String,Object> headers)
          Sends the body to an endpoint with the specified headers and header values.
<T> T
requestBodyAndHeaders(Endpoint endpoint, Object body, Map<String,Object> headers, Class<T> type)
          Sends the body to an endpoint with the specified headers and header values.
 Object requestBodyAndHeaders(Object body, Map<String,Object> headers)
          Sends the body to the default endpoint and returns the result content Uses an ExchangePattern.InOut message exchange pattern.
 Object requestBodyAndHeaders(String endpointUri, Object body, Map<String,Object> headers)
          Sends the body to an endpoint with the specified headers and header values.
<T> T
requestBodyAndHeaders(String endpointUri, Object body, Map<String,Object> headers, Class<T> type)
          Sends the body to an endpoint with the specified headers and header values.
protected  Endpoint resolveMandatoryEndpoint(String endpointUri)
           
 Exchange send(Endpoint endpoint, Exchange exchange)
          Sends the exchange to the given endpoint

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

 Exchange send(Endpoint endpoint, ExchangePattern pattern, Processor processor)
          Sends an exchange to an endpoint using a supplied processor

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

 Exchange send(Endpoint endpoint, Processor processor)
          Sends an exchange to an endpoint using a supplied processor

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

 Exchange send(Exchange exchange)
          Sends the exchange to the default endpoint

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().
 Exchange send(Processor processor)
          Sends an exchange to the default endpoint using a supplied processor

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().
 Exchange send(String endpointUri, Exchange exchange)
          Sends the exchange to the given endpoint

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

 Exchange send(String endpointUri, ExchangePattern pattern, Processor processor)
          Sends an exchange to an endpoint using a supplied processor

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

 Exchange send(String endpointUri, Processor processor)
          Sends an exchange to an endpoint using a supplied processor

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

 Object sendBody(Endpoint endpoint, ExchangePattern pattern, Object body)
          Send the body to an endpoint with the given ExchangePattern returning any result output body

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void sendBody(Endpoint endpoint, Object body)
          Send the body to an endpoint

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void sendBody(Object body)
          Sends the body to the default endpoint

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 Object sendBody(String endpointUri, ExchangePattern pattern, Object body)
          Send the body to an endpoint returning any result output body

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void sendBody(String endpointUri, Object body)
          Send the body to an endpoint

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 Object sendBodyAndHeader(Endpoint endpoint, ExchangePattern pattern, Object body, String header, Object headerValue)
          Sends the body to an endpoint with a specified header and header value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void sendBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue)
          Sends the body to an endpoint with a specified header and header value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void sendBodyAndHeader(Object body, String header, Object headerValue)
          Sends the body to the default endpoint with a specified header and header value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 Object sendBodyAndHeader(String endpoint, ExchangePattern pattern, Object body, String header, Object headerValue)
          Sends the body to an endpoint with a specified header and header value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void sendBodyAndHeader(String endpointUri, Object body, String header, Object headerValue)
          Sends the body to an endpoint with a specified header and header value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 Object sendBodyAndHeaders(Endpoint endpoint, ExchangePattern pattern, Object body, Map<String,Object> headers)
          Sends the body to an endpoint with the specified headers and header values

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void sendBodyAndHeaders(Endpoint endpoint, Object body, Map<String,Object> headers)
          Sends the body to an endpoint with the specified headers and header values

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void sendBodyAndHeaders(Object body, Map<String,Object> headers)
          Sends the body to the default endpoint with the specified headers and header values

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 Object sendBodyAndHeaders(String endpointUri, ExchangePattern pattern, Object body, Map<String,Object> headers)
          Sends the body to an endpoint with the specified headers and header values

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void sendBodyAndHeaders(String endpointUri, Object body, Map<String,Object> headers)
          Sends the body to an endpoint with the specified headers and header values

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 Object sendBodyAndProperty(Endpoint endpoint, ExchangePattern pattern, Object body, String property, Object propertyValue)
          Sends the body to an endpoint with a specified property and property value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void sendBodyAndProperty(Endpoint endpoint, Object body, String property, Object propertyValue)
          Sends the body to an endpoint with a specified property and property value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void sendBodyAndProperty(Object body, String property, Object propertyValue)
          Sends the body to the default endpoint with a specified property and property value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 Object sendBodyAndProperty(String endpoint, ExchangePattern pattern, Object body, String property, Object propertyValue)
          Sends the body to an endpoint with a specified property and property value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void sendBodyAndProperty(String endpointUri, Object body, String property, Object propertyValue)
          Sends the body to an endpoint with a specified property and property value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

 void setDefaultEndpoint(Endpoint defaultEndpoint)
          Sets the default endpoint to use if none is specified
 void setDefaultEndpointUri(String endpointUri)
          Sets the default endpoint to use if none is specified
 void setExecutorService(ExecutorService executorService)
          Sets a custom executor service to use for async messaging.
 void setMaximumCacheSize(int maximumCacheSize)
          Sets a custom maximum cache size to use in the backing cache pools.
 
Methods inherited from class org.apache.camel.support.ServiceSupport
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, start, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Constructor Detail

DefaultProducerTemplate

public DefaultProducerTemplate(CamelContext context)

DefaultProducerTemplate

public DefaultProducerTemplate(CamelContext context,
                               ExecutorService executor)

DefaultProducerTemplate

public DefaultProducerTemplate(CamelContext context,
                               Endpoint defaultEndpoint)
Method Detail

newInstance

public static DefaultProducerTemplate newInstance(CamelContext camelContext,
                                                  String defaultEndpointUri)

getMaximumCacheSize

public int getMaximumCacheSize()
Description copied from interface: ProducerTemplate
Gets the maximum cache size used in the backing cache pools.

Specified by:
getMaximumCacheSize in interface ProducerTemplate
Returns:
the maximum cache size

setMaximumCacheSize

public void setMaximumCacheSize(int maximumCacheSize)
Description copied from interface: ProducerTemplate
Sets a custom maximum cache size to use in the backing cache pools.

Specified by:
setMaximumCacheSize in interface ProducerTemplate
Parameters:
maximumCacheSize - the custom maximum cache size

getCurrentCacheSize

public int getCurrentCacheSize()
Description copied from interface: ProducerTemplate
Gets an approximated size of the current cached resources in the backing cache pools.

Specified by:
getCurrentCacheSize in interface ProducerTemplate
Returns:
the size of current cached resources

send

public Exchange send(String endpointUri,
                     Exchange exchange)
Description copied from interface: ProducerTemplate
Sends the exchange to the given endpoint

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

Specified by:
send in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send the exchange to
exchange - the exchange to send
Returns:
the returned exchange

send

public Exchange send(String endpointUri,
                     Processor processor)
Description copied from interface: ProducerTemplate
Sends an exchange to an endpoint using a supplied processor

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

Specified by:
send in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send the exchange to
processor - the transformer used to populate the new exchange Processor to populate the exchange
Returns:
the returned exchange

send

public Exchange send(String endpointUri,
                     ExchangePattern pattern,
                     Processor processor)
Description copied from interface: ProducerTemplate
Sends an exchange to an endpoint using a supplied processor

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

Specified by:
send in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send the exchange to
pattern - the message ExchangePattern such as ExchangePattern.InOnly or ExchangePattern.InOut
processor - the transformer used to populate the new exchange Processor to populate the exchange
Returns:
the returned exchange

send

public Exchange send(Endpoint endpoint,
                     Exchange exchange)
Description copied from interface: ProducerTemplate
Sends the exchange to the given endpoint

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

Specified by:
send in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
exchange - the exchange to send
Returns:
the returned exchange

send

public Exchange send(Endpoint endpoint,
                     Processor processor)
Description copied from interface: ProducerTemplate
Sends an exchange to an endpoint using a supplied processor

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

Specified by:
send in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
processor - the transformer used to populate the new exchange Processor to populate the exchange
Returns:
the returned exchange

send

public Exchange send(Endpoint endpoint,
                     ExchangePattern pattern,
                     Processor processor)
Description copied from interface: ProducerTemplate
Sends an exchange to an endpoint using a supplied processor

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

Specified by:
send in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
pattern - the message ExchangePattern such as ExchangePattern.InOnly or ExchangePattern.InOut
processor - the transformer used to populate the new exchange Processor to populate the exchange
Returns:
the returned exchange

sendBody

public Object sendBody(Endpoint endpoint,
                       ExchangePattern pattern,
                       Object body)
Description copied from interface: ProducerTemplate
Send the body to an endpoint with the given ExchangePattern returning any result output body

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBody in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
pattern - the message ExchangePattern such as ExchangePattern.InOnly or ExchangePattern.InOut
body - the payload
Returns:
the result if ExchangePattern is OUT capable, otherwise null

sendBody

public void sendBody(Endpoint endpoint,
                     Object body)
              throws CamelExecutionException
Description copied from interface: ProducerTemplate
Send the body to an endpoint

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBody in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
body - the payload
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBody

public void sendBody(String endpointUri,
                     Object body)
              throws CamelExecutionException
Description copied from interface: ProducerTemplate
Send the body to an endpoint

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBody in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send the exchange to
body - the payload
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBody

public Object sendBody(String endpointUri,
                       ExchangePattern pattern,
                       Object body)
                throws CamelExecutionException
Description copied from interface: ProducerTemplate
Send the body to an endpoint returning any result output body

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBody in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send the exchange to
pattern - the message ExchangePattern such as ExchangePattern.InOnly or ExchangePattern.InOut
body - the payload
Returns:
the result if ExchangePattern is OUT capable, otherwise null
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBodyAndHeader

public void sendBodyAndHeader(String endpointUri,
                              Object body,
                              String header,
                              Object headerValue)
                       throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with a specified header and header value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndHeader in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send to
body - the payload to send
header - the header name
headerValue - the header value
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBodyAndHeader

public void sendBodyAndHeader(Endpoint endpoint,
                              Object body,
                              String header,
                              Object headerValue)
                       throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with a specified header and header value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndHeader in interface ProducerTemplate
Parameters:
endpoint - the Endpoint to send to
body - the payload to send
header - the header name
headerValue - the header value
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBodyAndHeader

public Object sendBodyAndHeader(Endpoint endpoint,
                                ExchangePattern pattern,
                                Object body,
                                String header,
                                Object headerValue)
                         throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with a specified header and header value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndHeader in interface ProducerTemplate
Parameters:
endpoint - the Endpoint to send to
pattern - the message ExchangePattern such as ExchangePattern.InOnly or ExchangePattern.InOut
body - the payload to send
header - the header name
headerValue - the header value
Returns:
the result if ExchangePattern is OUT capable, otherwise null
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBodyAndHeader

public Object sendBodyAndHeader(String endpoint,
                                ExchangePattern pattern,
                                Object body,
                                String header,
                                Object headerValue)
                         throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with a specified header and header value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndHeader in interface ProducerTemplate
Parameters:
endpoint - the Endpoint URI to send to
pattern - the message ExchangePattern such as ExchangePattern.InOnly or ExchangePattern.InOut
body - the payload to send
header - the header name
headerValue - the header value
Returns:
the result if ExchangePattern is OUT capable, otherwise null
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBodyAndProperty

public void sendBodyAndProperty(String endpointUri,
                                Object body,
                                String property,
                                Object propertyValue)
                         throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with a specified property and property value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndProperty in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send to
body - the payload to send
property - the property name
propertyValue - the property value
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBodyAndProperty

public void sendBodyAndProperty(Endpoint endpoint,
                                Object body,
                                String property,
                                Object propertyValue)
                         throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with a specified property and property value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndProperty in interface ProducerTemplate
Parameters:
endpoint - the Endpoint to send to
body - the payload to send
property - the property name
propertyValue - the property value
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBodyAndProperty

public Object sendBodyAndProperty(Endpoint endpoint,
                                  ExchangePattern pattern,
                                  Object body,
                                  String property,
                                  Object propertyValue)
                           throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with a specified property and property value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndProperty in interface ProducerTemplate
Parameters:
endpoint - the Endpoint to send to
pattern - the message ExchangePattern such as ExchangePattern.InOnly or ExchangePattern.InOut
body - the payload to send
property - the property name
propertyValue - the property value
Returns:
the result if ExchangePattern is OUT capable, otherwise null
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBodyAndProperty

public Object sendBodyAndProperty(String endpoint,
                                  ExchangePattern pattern,
                                  Object body,
                                  String property,
                                  Object propertyValue)
                           throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with a specified property and property value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndProperty in interface ProducerTemplate
Parameters:
endpoint - the Endpoint URI to send to
pattern - the message ExchangePattern such as ExchangePattern.InOnly or ExchangePattern.InOut
body - the payload to send
property - the property name
propertyValue - the property value
Returns:
the result if ExchangePattern is OUT capable, otherwise null
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBodyAndHeaders

public void sendBodyAndHeaders(String endpointUri,
                               Object body,
                               Map<String,Object> headers)
                        throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with the specified headers and header values

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndHeaders in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send to
body - the payload to send
headers - headers
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBodyAndHeaders

public void sendBodyAndHeaders(Endpoint endpoint,
                               Object body,
                               Map<String,Object> headers)
                        throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with the specified headers and header values

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndHeaders in interface ProducerTemplate
Parameters:
endpoint - the endpoint URI to send to
body - the payload to send
headers - headers
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBodyAndHeaders

public Object sendBodyAndHeaders(String endpointUri,
                                 ExchangePattern pattern,
                                 Object body,
                                 Map<String,Object> headers)
                          throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with the specified headers and header values

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndHeaders in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send to
pattern - the message ExchangePattern such as ExchangePattern.InOnly or ExchangePattern.InOut
body - the payload to send
headers - headers
Returns:
the result if ExchangePattern is OUT capable, otherwise null
Throws:
CamelExecutionException - if the processing of the exchange failed

sendBodyAndHeaders

public Object sendBodyAndHeaders(Endpoint endpoint,
                                 ExchangePattern pattern,
                                 Object body,
                                 Map<String,Object> headers)
                          throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with the specified headers and header values

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndHeaders in interface ProducerTemplate
Parameters:
endpoint - the endpoint URI to send to
pattern - the message ExchangePattern such as ExchangePattern.InOnly or ExchangePattern.InOut
body - the payload to send
headers - headers
Returns:
the result if ExchangePattern is OUT capable, otherwise null
Throws:
CamelExecutionException - if the processing of the exchange failed

request

public Exchange request(Endpoint endpoint,
                        Processor processor)
Description copied from interface: ProducerTemplate
Sends an exchange to an endpoint using a supplied processor Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

Specified by:
request in interface ProducerTemplate
Parameters:
endpoint - the Endpoint to send to
processor - the processor which will populate the exchange before sending
Returns:
the result (see class javadoc)

requestBody

public Object requestBody(Object body)
                   throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to the default endpoint and returns the result content Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBody in interface ProducerTemplate
Parameters:
body - the payload to send
Returns:
the result (see class javadoc)
Throws:
CamelExecutionException - if the processing of the exchange failed

requestBody

public Object requestBody(Endpoint endpoint,
                          Object body)
                   throws CamelExecutionException
Description copied from interface: ProducerTemplate
Send the body to an endpoint returning any result output body. Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBody in interface ProducerTemplate
Parameters:
endpoint - the Endpoint to send to
body - the payload
Returns:
the result (see class javadoc)
Throws:
CamelExecutionException - if the processing of the exchange failed

requestBodyAndHeader

public Object requestBodyAndHeader(Object body,
                                   String header,
                                   Object headerValue)
                            throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends the body to the default endpoint and returns the result content Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBodyAndHeader in interface ProducerTemplate
Parameters:
body - the payload
header - the header name
headerValue - the header value
Returns:
the result (see class javadoc)
Throws:
CamelExecutionException - if the processing of the exchange failed

requestBodyAndHeader

public Object requestBodyAndHeader(Endpoint endpoint,
                                   Object body,
                                   String header,
                                   Object headerValue)
                            throws CamelExecutionException
Description copied from interface: ProducerTemplate
Send the body to an endpoint returning any result output body. Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBodyAndHeader in interface ProducerTemplate
Parameters:
endpoint - the Endpoint to send to
body - the payload
header - the header name
headerValue - the header value
Returns:
the result (see class javadoc)
Throws:
CamelExecutionException - if the processing of the exchange failed

request

public Exchange request(String endpoint,
                        Processor processor)
                 throws CamelExecutionException
Description copied from interface: ProducerTemplate
Sends an exchange to an endpoint using a supplied processor Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

Specified by:
request in interface ProducerTemplate
Parameters:
endpoint - the endpoint URI to send to
processor - the processor which will populate the exchange before sending
Returns:
the result (see class javadoc)
Throws:
CamelExecutionException

requestBody

public Object requestBody(String endpoint,
                          Object body)
                   throws CamelExecutionException
Description copied from interface: ProducerTemplate
Send the body to an endpoint returning any result output body. Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBody in interface ProducerTemplate
Parameters:
endpoint - the endpoint URI to send to
body - the payload
Returns:
the result (see class javadoc)
Throws:
CamelExecutionException - if the processing of the exchange failed

requestBodyAndHeader

public Object requestBodyAndHeader(String endpoint,
                                   Object body,
                                   String header,
                                   Object headerValue)
                            throws CamelExecutionException
Description copied from interface: ProducerTemplate
Send the body to an endpoint returning any result output body. Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBodyAndHeader in interface ProducerTemplate
Parameters:
endpoint - the endpoint URI to send to
body - the payload
header - the header name
headerValue - the header value
Returns:
the result (see class javadoc)
Throws:
CamelExecutionException - if the processing of the exchange failed

requestBodyAndHeaders

public Object requestBodyAndHeaders(String endpointUri,
                                    Object body,
                                    Map<String,Object> headers)
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with the specified headers and header values. Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBodyAndHeaders in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send to
body - the payload to send
headers - headers
Returns:
the result (see class javadoc)

requestBodyAndHeaders

public Object requestBodyAndHeaders(Endpoint endpoint,
                                    Object body,
                                    Map<String,Object> headers)
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with the specified headers and header values. Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBodyAndHeaders in interface ProducerTemplate
Parameters:
endpoint - the endpoint URI to send to
body - the payload to send
headers - headers
Returns:
the result (see class javadoc)

requestBodyAndHeaders

public Object requestBodyAndHeaders(Object body,
                                    Map<String,Object> headers)
Description copied from interface: ProducerTemplate
Sends the body to the default endpoint and returns the result content Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBodyAndHeaders in interface ProducerTemplate
Parameters:
body - the payload to send
headers - headers
Returns:
the result (see class javadoc)

requestBody

public <T> T requestBody(Object body,
                         Class<T> type)
Description copied from interface: ProducerTemplate
Sends the body to the default endpoint and returns the result content Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBody in interface ProducerTemplate
Parameters:
body - the payload to send
type - the expected response type
Returns:
the result (see class javadoc)

requestBody

public <T> T requestBody(Endpoint endpoint,
                         Object body,
                         Class<T> type)
Description copied from interface: ProducerTemplate
Send the body to an endpoint returning any result output body. Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBody in interface ProducerTemplate
Parameters:
endpoint - the Endpoint to send to
body - the payload
type - the expected response type
Returns:
the result (see class javadoc)

requestBody

public <T> T requestBody(String endpointUri,
                         Object body,
                         Class<T> type)
Description copied from interface: ProducerTemplate
Send the body to an endpoint returning any result output body. Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBody in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send to
body - the payload
type - the expected response type
Returns:
the result (see class javadoc)

requestBodyAndHeader

public <T> T requestBodyAndHeader(Endpoint endpoint,
                                  Object body,
                                  String header,
                                  Object headerValue,
                                  Class<T> type)
Description copied from interface: ProducerTemplate
Send the body to an endpoint returning any result output body. Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBodyAndHeader in interface ProducerTemplate
Parameters:
endpoint - the Endpoint to send to
body - the payload
header - the header name
headerValue - the header value
type - the expected response type
Returns:
the result (see class javadoc)

requestBodyAndHeader

public <T> T requestBodyAndHeader(String endpointUri,
                                  Object body,
                                  String header,
                                  Object headerValue,
                                  Class<T> type)
Description copied from interface: ProducerTemplate
Send the body to an endpoint returning any result output body. Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBodyAndHeader in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send to
body - the payload
header - the header name
headerValue - the header value
type - the expected response type
Returns:
the result (see class javadoc)

requestBodyAndHeaders

public <T> T requestBodyAndHeaders(String endpointUri,
                                   Object body,
                                   Map<String,Object> headers,
                                   Class<T> type)
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with the specified headers and header values. Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBodyAndHeaders in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send to
body - the payload to send
headers - headers
type - the expected response type
Returns:
the result (see class javadoc)

requestBodyAndHeaders

public <T> T requestBodyAndHeaders(Endpoint endpoint,
                                   Object body,
                                   Map<String,Object> headers,
                                   Class<T> type)
Description copied from interface: ProducerTemplate
Sends the body to an endpoint with the specified headers and header values. Uses an ExchangePattern.InOut message exchange pattern.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
requestBodyAndHeaders in interface ProducerTemplate
Parameters:
endpoint - the endpoint URI to send to
body - the payload to send
headers - headers
type - the expected response type
Returns:
the result (see class javadoc)

sendBody

public void sendBody(Object body)
Description copied from interface: ProducerTemplate
Sends the body to the default endpoint

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBody in interface ProducerTemplate
Parameters:
body - the payload to send

send

public Exchange send(Exchange exchange)
Description copied from interface: ProducerTemplate
Sends the exchange to the default endpoint

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

Specified by:
send in interface ProducerTemplate
Parameters:
exchange - the exchange to send
Returns:
the returned exchange

send

public Exchange send(Processor processor)
Description copied from interface: ProducerTemplate
Sends an exchange to the default endpoint using a supplied processor

Notice: that if the processing of the exchange failed with an Exception it is not thrown from this method, but you can access it from the returned exchange using Exchange.getException().

Specified by:
send in interface ProducerTemplate
Parameters:
processor - the transformer used to populate the new exchange Processor to populate the exchange
Returns:
the returned exchange

sendBodyAndHeader

public void sendBodyAndHeader(Object body,
                              String header,
                              Object headerValue)
Description copied from interface: ProducerTemplate
Sends the body to the default endpoint with a specified header and header value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndHeader in interface ProducerTemplate
Parameters:
body - the payload to send
header - the header name
headerValue - the header value

sendBodyAndProperty

public void sendBodyAndProperty(Object body,
                                String property,
                                Object propertyValue)
Description copied from interface: ProducerTemplate
Sends the body to the default endpoint with a specified property and property value

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndProperty in interface ProducerTemplate
Parameters:
body - the payload to send
property - the property name
propertyValue - the property value

sendBodyAndHeaders

public void sendBodyAndHeaders(Object body,
                               Map<String,Object> headers)
Description copied from interface: ProducerTemplate
Sends the body to the default endpoint with the specified headers and header values

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
sendBodyAndHeaders in interface ProducerTemplate
Parameters:
body - the payload to send
headers - the headers

getContext

public CamelContext getContext()

getDefaultEndpoint

public Endpoint getDefaultEndpoint()
Description copied from interface: ProducerTemplate
Get the default endpoint to use if none is specified

Specified by:
getDefaultEndpoint in interface ProducerTemplate
Returns:
the default endpoint instance

setDefaultEndpoint

public void setDefaultEndpoint(Endpoint defaultEndpoint)
Description copied from interface: ProducerTemplate
Sets the default endpoint to use if none is specified

Specified by:
setDefaultEndpoint in interface ProducerTemplate
Parameters:
defaultEndpoint - the default endpoint instance

setDefaultEndpointUri

public void setDefaultEndpointUri(String endpointUri)
Sets the default endpoint to use if none is specified

Specified by:
setDefaultEndpointUri in interface ProducerTemplate
Parameters:
endpointUri - the default endpoint uri

getResolvedEndpoint

public <T extends Endpoint> T getResolvedEndpoint(String endpointUri,
                                                  Class<T> expectedClass)

createBodyAndHeaderProcessor

protected Processor createBodyAndHeaderProcessor(Object body,
                                                 String header,
                                                 Object headerValue)

createBodyAndPropertyProcessor

protected Processor createBodyAndPropertyProcessor(Object body,
                                                   String property,
                                                   Object propertyValue)

createSetBodyProcessor

protected Processor createSetBodyProcessor(Object body)

resolveMandatoryEndpoint

protected Endpoint resolveMandatoryEndpoint(String endpointUri)

getMandatoryDefaultEndpoint

protected Endpoint getMandatoryDefaultEndpoint()

extractResultBody

protected Object extractResultBody(Exchange result)

extractResultBody

protected Object extractResultBody(Exchange result,
                                   ExchangePattern pattern)

setExecutorService

public void setExecutorService(ExecutorService executorService)
Description copied from interface: ProducerTemplate
Sets a custom executor service to use for async messaging.

Specified by:
setExecutorService in interface ProducerTemplate
Parameters:
executorService - the executor service.

asyncSend

public Future<Exchange> asyncSend(String uri,
                                  Exchange exchange)
Description copied from interface: ProducerTemplate
Sends an asynchronous exchange to the given endpoint.

Specified by:
asyncSend in interface ProducerTemplate
Parameters:
uri - the endpoint URI to send the exchange to
exchange - the exchange to send
Returns:
a handle to be used to get the response in the future

asyncSend

public Future<Exchange> asyncSend(String uri,
                                  Processor processor)
Description copied from interface: ProducerTemplate
Sends an asynchronous exchange to the given endpoint.

Specified by:
asyncSend in interface ProducerTemplate
Parameters:
uri - the endpoint URI to send the exchange to
processor - the transformer used to populate the new exchange
Returns:
a handle to be used to get the response in the future

asyncSendBody

public Future<Object> asyncSendBody(String uri,
                                    Object body)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOnly message exchange pattern.

Specified by:
asyncSendBody in interface ProducerTemplate
Parameters:
uri - the endpoint URI to send the exchange to
body - the body to send
Returns:
a handle to be used to get the response in the future

asyncRequestBody

public Future<Object> asyncRequestBody(String uri,
                                       Object body)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncRequestBody in interface ProducerTemplate
Parameters:
uri - the endpoint URI to send the exchange to
body - the body to send
Returns:
a handle to be used to get the response in the future

asyncRequestBody

public <T> Future<T> asyncRequestBody(String uri,
                                      Object body,
                                      Class<T> type)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncRequestBody in interface ProducerTemplate
Parameters:
uri - the endpoint URI to send the exchange to
body - the body to send
type - the expected response type
Returns:
a handle to be used to get the response in the future

asyncRequestBodyAndHeader

public Future<Object> asyncRequestBodyAndHeader(String endpointUri,
                                                Object body,
                                                String header,
                                                Object headerValue)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncRequestBodyAndHeader in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send the exchange to
body - the body to send
header - the header name
headerValue - the header value
Returns:
a handle to be used to get the response in the future

asyncRequestBodyAndHeader

public <T> Future<T> asyncRequestBodyAndHeader(String endpointUri,
                                               Object body,
                                               String header,
                                               Object headerValue,
                                               Class<T> type)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncRequestBodyAndHeader in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send the exchange to
body - the body to send
header - the header name
headerValue - the header value
type - the expected response type
Returns:
a handle to be used to get the response in the future

asyncRequestBodyAndHeaders

public Future<Object> asyncRequestBodyAndHeaders(String endpointUri,
                                                 Object body,
                                                 Map<String,Object> headers)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncRequestBodyAndHeaders in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send the exchange to
body - the body to send
headers - headers
Returns:
a handle to be used to get the response in the future

asyncRequestBodyAndHeaders

public <T> Future<T> asyncRequestBodyAndHeaders(String endpointUri,
                                                Object body,
                                                Map<String,Object> headers,
                                                Class<T> type)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncRequestBodyAndHeaders in interface ProducerTemplate
Parameters:
endpointUri - the endpoint URI to send the exchange to
body - the body to send
headers - headers
type - the expected response type
Returns:
a handle to be used to get the response in the future

extractFutureBody

public <T> T extractFutureBody(Future<Object> future,
                               Class<T> type)
Description copied from interface: ProducerTemplate
Gets the response body from the future handle, will wait until the response is ready.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
extractFutureBody in interface ProducerTemplate
Parameters:
future - the handle to get the response
type - the expected response type
Returns:
the result (see class javadoc)

extractFutureBody

public <T> T extractFutureBody(Future<Object> future,
                               long timeout,
                               TimeUnit unit,
                               Class<T> type)
                    throws TimeoutException
Description copied from interface: ProducerTemplate
Gets the response body from the future handle, will wait at most the given time for the response to be ready.

Notice: that if the processing of the exchange failed with an Exception it is thrown from this method as a CamelExecutionException with the caused exception wrapped.

Specified by:
extractFutureBody in interface ProducerTemplate
Parameters:
future - the handle to get the response
timeout - the maximum time to wait
unit - the time unit of the timeout argument
type - the expected response type
Returns:
the result (see class javadoc)
Throws:
TimeoutException - if the wait timed out

asyncCallbackSendBody

public Future<Object> asyncCallbackSendBody(String uri,
                                            Object body,
                                            Synchronization onCompletion)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOnly message exchange pattern.

Specified by:
asyncCallbackSendBody in interface ProducerTemplate
Parameters:
uri - the endpoint URI to send the exchange to
body - the body to send
onCompletion - callback invoked when exchange has been completed
Returns:
a handle to be used to get the response in the future

asyncCallbackSendBody

public Future<Object> asyncCallbackSendBody(Endpoint endpoint,
                                            Object body,
                                            Synchronization onCompletion)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOnly message exchange pattern.

Specified by:
asyncCallbackSendBody in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
body - the body to send
onCompletion - callback invoked when exchange has been completed
Returns:
a handle to be used to get the response in the future

asyncCallbackRequestBody

public Future<Object> asyncCallbackRequestBody(String uri,
                                               Object body,
                                               Synchronization onCompletion)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncCallbackRequestBody in interface ProducerTemplate
Parameters:
uri - the endpoint URI to send the exchange to
body - the body to send
onCompletion - callback invoked when exchange has been completed
Returns:
a handle to be used to get the response in the future

asyncCallbackRequestBody

public Future<Object> asyncCallbackRequestBody(Endpoint endpoint,
                                               Object body,
                                               Synchronization onCompletion)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncCallbackRequestBody in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
body - the body to send
onCompletion - callback invoked when exchange has been completed
Returns:
a handle to be used to get the response in the future

asyncCallback

public Future<Exchange> asyncCallback(String uri,
                                      Exchange exchange,
                                      Synchronization onCompletion)
Description copied from interface: ProducerTemplate
Sends an asynchronous exchange to the given endpoint.

Specified by:
asyncCallback in interface ProducerTemplate
Parameters:
uri - the endpoint URI to send the exchange to
exchange - the exchange to send
onCompletion - callback invoked when exchange has been completed
Returns:
a handle to be used to get the response in the future

asyncCallback

public Future<Exchange> asyncCallback(String uri,
                                      Processor processor,
                                      Synchronization onCompletion)
Description copied from interface: ProducerTemplate
Sends an asynchronous exchange to the given endpoint using a supplied processor.

Specified by:
asyncCallback in interface ProducerTemplate
Parameters:
uri - the endpoint URI to send the exchange to
processor - the transformer used to populate the new exchange Processor to populate the exchange
onCompletion - callback invoked when exchange has been completed
Returns:
a handle to be used to get the response in the future

asyncRequestBody

public Future<Object> asyncRequestBody(Endpoint endpoint,
                                       Object body)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncRequestBody in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
body - the body to send
Returns:
a handle to be used to get the response in the future

asyncRequestBody

public <T> Future<T> asyncRequestBody(Endpoint endpoint,
                                      Object body,
                                      Class<T> type)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncRequestBody in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
body - the body to send
type - the expected response type
Returns:
a handle to be used to get the response in the future

asyncRequestBodyAndHeader

public Future<Object> asyncRequestBodyAndHeader(Endpoint endpoint,
                                                Object body,
                                                String header,
                                                Object headerValue)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncRequestBodyAndHeader in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
body - the body to send
header - the header name
headerValue - the header value
Returns:
a handle to be used to get the response in the future

asyncRequestBodyAndHeader

public <T> Future<T> asyncRequestBodyAndHeader(Endpoint endpoint,
                                               Object body,
                                               String header,
                                               Object headerValue,
                                               Class<T> type)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncRequestBodyAndHeader in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
body - the body to send
header - the header name
headerValue - the header value
type - the expected response type
Returns:
a handle to be used to get the response in the future

asyncRequestBodyAndHeaders

public Future<Object> asyncRequestBodyAndHeaders(Endpoint endpoint,
                                                 Object body,
                                                 Map<String,Object> headers)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncRequestBodyAndHeaders in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
body - the body to send
headers - headers
Returns:
a handle to be used to get the response in the future

asyncRequestBodyAndHeaders

public <T> Future<T> asyncRequestBodyAndHeaders(Endpoint endpoint,
                                                Object body,
                                                Map<String,Object> headers,
                                                Class<T> type)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOut message exchange pattern.

Specified by:
asyncRequestBodyAndHeaders in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
body - the body to send
headers - headers
type - the expected response type
Returns:
a handle to be used to get the response in the future

asyncSend

public Future<Exchange> asyncSend(Endpoint endpoint,
                                  Exchange exchange)
Description copied from interface: ProducerTemplate
Sends an asynchronous exchange to the given endpoint.

Specified by:
asyncSend in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
exchange - the exchange to send
Returns:
a handle to be used to get the response in the future

asyncSend

public Future<Exchange> asyncSend(Endpoint endpoint,
                                  Processor processor)
Description copied from interface: ProducerTemplate
Sends an asynchronous exchange to the given endpoint.

Specified by:
asyncSend in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
processor - the transformer used to populate the new exchange
Returns:
a handle to be used to get the response in the future

asyncSendBody

public Future<Object> asyncSendBody(Endpoint endpoint,
                                    Object body)
Description copied from interface: ProducerTemplate
Sends an asynchronous body to the given endpoint. Uses an ExchangePattern.InOnly message exchange pattern.

Specified by:
asyncSendBody in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
body - the body to send
Returns:
a handle to be used to get the response in the future

asyncCallback

public Future<Exchange> asyncCallback(Endpoint endpoint,
                                      Exchange exchange,
                                      Synchronization onCompletion)
Description copied from interface: ProducerTemplate
Sends an asynchronous exchange to the given endpoint.

Specified by:
asyncCallback in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
exchange - the exchange to send
onCompletion - callback invoked when exchange has been completed
Returns:
a handle to be used to get the response in the future

asyncCallback

public Future<Exchange> asyncCallback(Endpoint endpoint,
                                      Processor processor,
                                      Synchronization onCompletion)
Description copied from interface: ProducerTemplate
Sends an asynchronous exchange to the given endpoint using a supplied processor.

Specified by:
asyncCallback in interface ProducerTemplate
Parameters:
endpoint - the endpoint to send the exchange to
processor - the transformer used to populate the new exchange Processor to populate the exchange
onCompletion - callback invoked when exchange has been completed
Returns:
a handle to be used to get the response in the future

doStart

protected void doStart()
                throws Exception
Description copied from class: ServiceSupport
Implementations override this method to support customized start/stop.

Important: See ServiceSupport.doStop() for more details.

Specified by:
doStart in class ServiceSupport
Throws:
Exception
See Also:
ServiceSupport.doStop()

doStop

protected void doStop()
               throws Exception
Description copied from class: ServiceSupport
Implementations override this method to support customized start/stop.

Important: Camel will invoke this ServiceSupport.doStop() method when the service is being stopped. This method will also be invoked if the service is still in uninitialized state (eg has not been started). The method is always called to allow the service to do custom logic when the service is being stopped, such as when CamelContext is shutting down.

Specified by:
doStop in class ServiceSupport
Throws:
Exception
See Also:
ServiceSupport.doStart()


Apache CAMEL