org.apache.camel
Interface ProducerTemplate<E extends Exchange>

All Superinterfaces:
Service
All Known Implementing Classes:
CamelTemplate, DefaultProducerTemplate

public interface ProducerTemplate<E extends Exchange>
extends Service

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

All methods throws RuntimeCamelException if processing of the Exchange failed and an Exception occured. The getCause method on RuntimeCamelException returns the wrapper original caused exception.

All the sendBody methods will return the content according to this strategy

Important note on usage: See this FAQ entry before using.

Version:
$Revision: 727288 $

Method Summary
 E request(Endpoint<E> endpoint, Processor processor)
          Sends an exchange to an endpoint using a supplied processor Uses an ExchangePattern.InOut message exchange pattern.
 Exchange request(String endpointUri, Processor processor)
          Sends an exchange to an endpoint using a supplied processor Uses an ExchangePattern.InOut message exchange pattern.
 Object requestBody(Endpoint<E> endpoint, Object body)
          Send the body to an endpoint returning any result output body.
 Object requestBody(String endpointUri, Object body)
          Send the body to an endpoint returning any result output body.
 Object requestBodyAndHeader(Endpoint<E> endpoint, Object body, String header, Object headerValue)
          Send the body to an endpoint returning any result output body.
 Object requestBodyAndHeader(String endpointUri, Object body, String header, Object headerValue)
          Send the body to an endpoint returning any result output body.
 Object requestBodyAndHeaders(Endpoint<E> endpoint, Object body, Map<String,Object> headers)
          Sends the body to an endpoint with the specified headers and header values.
 Object requestBodyAndHeaders(String endpointUri, Object body, Map<String,Object> headers)
          Sends the body to an endpoint with the specified headers and header values.
 E send(E exchange)
          Sends the exchange to the default endpoint
 E send(Endpoint<E> endpoint, E exchange)
          Sends the exchange to the given endpoint
 E send(Endpoint<E> endpoint, ExchangePattern pattern, Processor processor)
          Sends an exchange to an endpoint using a supplied processor
 E send(Endpoint<E> endpoint, Processor processor)
          Sends an exchange to an endpoint using a supplied processor
 E send(Endpoint<E> endpoint, Processor processor, AsyncCallback callback)
          Sends an exchange to an endpoint using a supplied processor
 E send(Processor processor)
          Sends an exchange to the default endpoint using a supplied processor
 E send(String endpointUri, E exchange)
          Sends the exchange to the given endpoint
 E send(String endpointUri, ExchangePattern pattern, Processor processor)
          Sends an exchange to an endpoint using a supplied processor
 E send(String endpointUri, Processor processor)
          Sends an exchange to an endpoint using a supplied processor
 E send(String endpointUri, Processor processor, AsyncCallback callback)
          Sends an exchange to an endpoint using a supplied processor
 Object sendBody(Endpoint<E> endpoint, ExchangePattern pattern, Object body)
          Send the body to an endpoint with the given ExchangePattern returning any result output body
 Object sendBody(Endpoint<E> endpoint, Object body)
          Send the body to an endpoint returning any result output body
 Object sendBody(Object body)
          Sends the body to the default endpoint and returns the result content
 Object sendBody(String endpointUri, ExchangePattern pattern, Object body)
          Send the body to an endpoint returning any result output body
 Object sendBody(String endpointUri, Object body)
          Send the body to an endpoint returning any result output body
 Object sendBodyAndHeader(Endpoint<E> endpoint, ExchangePattern pattern, Object body, String header, Object headerValue)
          Sends the body to an endpoint with a specified header and header value
 Object sendBodyAndHeader(Endpoint<E> endpoint, Object body, String header, Object headerValue)
          Sends the body to an endpoint with a specified header and header value
 Object sendBodyAndHeader(Object body, String header, Object headerValue)
          Sends the body to the default endpoint with a specified header and header value
 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
 Object sendBodyAndHeader(String endpointUri, Object body, String header, Object headerValue)
          Sends the body to an endpoint with a specified header and header value
 Object sendBodyAndHeaders(Endpoint<E> endpoint, ExchangePattern pattern, Object body, Map<String,Object> headers)
          Sends the body to an endpoint with the specified headers and header values
 Object sendBodyAndHeaders(Endpoint<E> endpoint, Object body, Map<String,Object> headers)
          Sends the body to an endpoint with the specified headers and header values
 Object sendBodyAndHeaders(Object body, Map<String,Object> headers)
          Sends the body to the default endpoint with the specified headers and header values
 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
 Object sendBodyAndHeaders(String endpointUri, Object body, Map<String,Object> headers)
          Sends the body to an endpoint with the specified headers and header values
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Method Detail

send

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

Parameters:
exchange - the exchange to send
Returns:
the returned exchange

send

E send(Processor processor)
Sends an exchange to the default endpoint using a supplied processor

Parameters:
processor - the transformer used to populate the new exchange Processor to populate the exchange
Returns:
the returned exchange

sendBody

Object sendBody(Object body)
Sends the body to the default endpoint and returns the result content

Parameters:
body - the payload to send
Returns:
the result (see class javadoc)

sendBodyAndHeader

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

Parameters:
body - the payload to send
header - the header name
headerValue - the header value
Returns:
the result (see class javadoc)

sendBodyAndHeaders

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

Parameters:
body - the payload to send
headers - the headers
Returns:
the result (see class javadoc)

send

E send(String endpointUri,
       E exchange)
Sends the exchange to the given endpoint

Parameters:
endpointUri - the endpoint URI to send the exchange to
exchange - the exchange to send
Returns:
the returned exchange

send

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

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

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

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

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

Parameters:
endpointUri - the endpoint URI to send the exchange to
processor - the transformer used to populate the new exchange Processor to populate the exchange.
callback - the callback will be called when the exchange is completed.
Returns:
the returned exchange

send

E send(Endpoint<E> endpoint,
       E exchange)
Sends the exchange to the given endpoint

Parameters:
endpoint - the endpoint to send the exchange to
exchange - the exchange to send
Returns:
the returned exchange

send

E send(Endpoint<E> endpoint,
       Processor processor)
Sends an exchange to an endpoint using a supplied processor

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

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

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

send

E send(Endpoint<E> endpoint,
       Processor processor,
       AsyncCallback callback)
Sends an exchange to an endpoint using a supplied processor

Parameters:
endpoint - the endpoint to send the exchange to
processor - the transformer used to populate the new exchange Processor to populate the exchange.
callback - the callback will be called when the exchange is completed.
Returns:
the returned exchange

sendBody

Object sendBody(Endpoint<E> endpoint,
                Object body)
Send the body to an endpoint returning any result output body

Parameters:
endpoint - the endpoint to send the exchange to
body - the payload
Returns:
the result (see class javadoc)

sendBody

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

Parameters:
endpointUri - the endpoint URI to send the exchange to
body - the payload
Returns:
the result (see class javadoc)

sendBody

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

Parameters:
endpoint - the endpoint to send the exchange to
body - the payload
pattern - the message ExchangePattern such as ExchangePattern.InOnly or ExchangePattern.InOut
Returns:
the result (see class javadoc)

sendBody

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

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 (see class javadoc)

sendBodyAndHeader

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

Parameters:
endpointUri - the endpoint URI to send to
body - the payload to send
header - the header name
headerValue - the header value
Returns:
the result (see class javadoc)

sendBodyAndHeader

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

Parameters:
endpoint - the Endpoint to send to
body - the payload to send
header - the header name
headerValue - the header value
Returns:
the result (see class javadoc)

sendBodyAndHeader

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

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 (see class javadoc)

sendBodyAndHeader

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

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 (see class javadoc)

sendBodyAndHeaders

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

Parameters:
endpointUri - the endpoint URI to send to
body - the payload to send
headers - headers
Returns:
the result (see class javadoc)

sendBodyAndHeaders

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

Parameters:
endpoint - the endpoint URI to send to
body - the payload to send
headers - headers
Returns:
the result (see class javadoc)

sendBodyAndHeaders

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

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 (see class javadoc)

sendBodyAndHeaders

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

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 (see class javadoc)

request

E request(Endpoint<E> endpoint,
          Processor processor)
Sends an exchange to an endpoint using a supplied processor Uses an ExchangePattern.InOut message exchange pattern.

Parameters:
endpoint - the Endpoint to send to
processor - the processor which will populate the exchange before sending
Returns:
the result (see class javadoc)

request

Exchange request(String endpointUri,
                 Processor processor)
Sends an exchange to an endpoint using a supplied processor Uses an ExchangePattern.InOut message exchange pattern.

Parameters:
endpointUri - the endpoint URI to send to
processor - the processor which will populate the exchange before sending
Returns:
the result (see class javadoc)

requestBody

Object requestBody(Endpoint<E> endpoint,
                   Object body)
Send the body to an endpoint returning any result output body. Uses an ExchangePattern.InOut message exchange pattern.

Parameters:
endpoint - the Endpoint to send to
body - the payload
Returns:
the result (see class javadoc)

requestBody

Object requestBody(String endpointUri,
                   Object body)
Send the body to an endpoint returning any result output body. Uses an ExchangePattern.InOut message exchange pattern.

Parameters:
endpointUri - the endpoint URI to send to
body - the payload
Returns:
the result (see class javadoc)

requestBodyAndHeader

Object requestBodyAndHeader(Endpoint<E> endpoint,
                            Object body,
                            String header,
                            Object headerValue)
Send the body to an endpoint returning any result output body. Uses an ExchangePattern.InOut message exchange pattern.

Parameters:
endpoint - the Endpoint to send to
body - the payload
header - the header name
headerValue - the header value
Returns:
the result (see class javadoc)

requestBodyAndHeader

Object requestBodyAndHeader(String endpointUri,
                            Object body,
                            String header,
                            Object headerValue)
Send the body to an endpoint returning any result output body. Uses an ExchangePattern.InOut message exchange pattern.

Parameters:
endpointUri - the endpoint URI to send to
body - the payload
header - the header name
headerValue - the header value
Returns:
the result (see class javadoc)

requestBodyAndHeaders

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

Parameters:
endpointUri - the endpoint URI to send to
body - the payload to send
headers - headers
Returns:
the result (see class javadoc)

requestBodyAndHeaders

Object requestBodyAndHeaders(Endpoint<E> endpoint,
                             Object body,
                             Map<String,Object> headers)
Sends the body to an endpoint with the specified headers and header values. Uses an ExchangePattern.InOut message exchange pattern.

Parameters:
endpoint - the endpoint URI to send to
body - the payload to send
headers - headers
Returns:
the result (see class javadoc)


Apache CAMEL