org.apache.camel
Interface ProducerTemplate

All Superinterfaces:
Service
All Known Implementing Classes:
DefaultProducerTemplate

public interface ProducerTemplate
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: 750400 $

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

Method Detail

send

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

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

send

Exchange 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)

sendBodyAndProperty

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

Parameters:
body - the payload to send
property - the property name
propertyValue - the property 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

Exchange send(String endpointUri,
              Exchange 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

Exchange 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

Exchange 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

Exchange 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

Exchange send(Endpoint endpoint,
              Exchange 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

Exchange send(Endpoint 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

Exchange send(Endpoint 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

Exchange send(Endpoint 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 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 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 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 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)

sendBodyAndProperty

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

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

sendBodyAndProperty

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

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

sendBodyAndProperty

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

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

sendBodyAndProperty

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

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 (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 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 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

Exchange request(Endpoint 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(Object body)
Sends the body to the default endpoint and returns the result content Uses an ExchangePattern.InOut message exchange pattern.

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

requestBody

Object requestBody(Endpoint 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 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 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)


Copyright © 2009 Apache Software Foundation. All Rights Reserved.