|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.camel.impl.ServiceSupport
org.apache.camel.impl.DefaultProducerTemplate<E>
public class DefaultProducerTemplate<E extends Exchange>
A client helper object (named like Spring's TransactionTemplate & JmsTemplate
et al) for working with Camel and sending Message instances in an
Exchange to an Endpoint.
| Constructor Summary | |
|---|---|
DefaultProducerTemplate(CamelContext context)
|
|
DefaultProducerTemplate(CamelContext context,
Endpoint defaultEndpoint)
|
|
| Method Summary | ||
|---|---|---|
protected Processor |
createBodyAndHeaderProcessor(Object body,
String header,
Object headerValue)
|
|
protected Processor |
createSetBodyProcessor(Object body)
|
|
protected void |
doStart()
|
|
protected void |
doStop()
|
|
protected Object |
extractResultBody(E result)
Extracts the body from the given result. |
|
protected Object |
extractResultBody(E result,
ExchangePattern pattern)
Extracts the body from the given result. |
|
CamelContext |
getContext()
|
|
Endpoint<E> |
getDefaultEndpoint()
|
|
protected Endpoint<E> |
getMandatoryDefaultEndpoint()
|
|
Producer<E> |
getProducer(Endpoint<E> endpoint)
|
|
|
getResolvedEndpoint(String endpointUri,
Class<T> expectedClass)
|
|
protected boolean |
hasFaultMessage(E result)
|
|
boolean |
isUseEndpointCache()
|
|
static DefaultProducerTemplate |
newInstance(CamelContext camelContext,
String defaultEndpointUri)
|
|
E |
request(Endpoint<E> endpoint,
Processor processor)
Sends an exchange to an endpoint using a supplied processor Uses an ExchangePattern.InOut message exchange pattern. |
|
E |
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<E> endpoint,
Object body)
Send the body to an endpoint returning any result output body. |
|
Object |
requestBody(String endpoint,
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 endpoint,
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. |
|
protected Endpoint |
resolveMandatoryEndpoint(String endpointUri)
|
|
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 |
|
void |
setDefaultEndpoint(Endpoint<E> defaultEndpoint)
|
|
void |
setDefaultEndpointUri(String endpointUri)
Sets the default endpoint to use if none is specified |
|
void |
setUseEndpointCache(boolean useEndpointCache)
|
|
| Methods inherited from class org.apache.camel.impl.ServiceSupport |
|---|
addChildService, getThreadName, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, nextThreadCounter, removeChildService, start, stop |
| 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 |
|---|
public DefaultProducerTemplate(CamelContext context)
public DefaultProducerTemplate(CamelContext context,
Endpoint defaultEndpoint)
| Method Detail |
|---|
public static DefaultProducerTemplate newInstance(CamelContext camelContext,
String defaultEndpointUri)
public E send(String endpointUri,
E exchange)
ProducerTemplate
send in interface ProducerTemplate<E extends Exchange>endpointUri - the endpoint URI to send the exchange toexchange - the exchange to send
public E send(String endpointUri,
Processor processor)
ProducerTemplate
send in interface ProducerTemplate<E extends Exchange>endpointUri - the endpoint URI to send the exchange toprocessor - the transformer used to populate the new exchange
Processor to populate the exchange
public E send(String endpointUri,
Processor processor,
AsyncCallback callback)
ProducerTemplate
send in interface ProducerTemplate<E extends Exchange>endpointUri - the endpoint URI to send the exchange toprocessor - the transformer used to populate the new exchange
Processor to populate the exchange.callback - the callback will be called when the exchange is completed.
public E send(String endpointUri,
ExchangePattern pattern,
Processor processor)
ProducerTemplate
send in interface ProducerTemplate<E extends Exchange>endpointUri - the endpoint URI to send the exchange topattern - the message ExchangePattern such as
ExchangePattern.InOnly or ExchangePattern.InOutprocessor - the transformer used to populate the new exchange
Processor to populate the exchange
public E send(Endpoint<E> endpoint,
E exchange)
ProducerTemplate
send in interface ProducerTemplate<E extends Exchange>endpoint - the endpoint to send the exchange toexchange - the exchange to send
public E send(Endpoint<E> endpoint,
Processor processor)
ProducerTemplate
send in interface ProducerTemplate<E extends Exchange>endpoint - the endpoint to send the exchange toprocessor - the transformer used to populate the new exchange
Processor to populate the exchange
public E send(Endpoint<E> endpoint,
Processor processor,
AsyncCallback callback)
ProducerTemplate
send in interface ProducerTemplate<E extends Exchange>endpoint - the endpoint to send the exchange toprocessor - the transformer used to populate the new exchange
Processor to populate the exchange.callback - the callback will be called when the exchange is completed.
public E send(Endpoint<E> endpoint,
ExchangePattern pattern,
Processor processor)
ProducerTemplate
send in interface ProducerTemplate<E extends Exchange>endpoint - the endpoint to send the exchange topattern - the message ExchangePattern such as
ExchangePattern.InOnly or ExchangePattern.InOutprocessor - the transformer used to populate the new exchange
Processor to populate the exchange
public Object sendBody(Endpoint<E> endpoint,
ExchangePattern pattern,
Object body)
ProducerTemplateExchangePattern
returning any result output body
sendBody in interface ProducerTemplate<E extends Exchange>endpoint - the endpoint to send the exchange topattern - the message ExchangePattern such as
ExchangePattern.InOnly or ExchangePattern.InOutbody - the payload
public Object sendBody(Endpoint<E> endpoint,
Object body)
ProducerTemplate
sendBody in interface ProducerTemplate<E extends Exchange>endpoint - the endpoint to send the exchange tobody - the payload
public Object sendBody(String endpointUri,
Object body)
ProducerTemplate
sendBody in interface ProducerTemplate<E extends Exchange>endpointUri - the endpoint URI to send the exchange tobody - the payload
public Object sendBody(String endpointUri,
ExchangePattern pattern,
Object body)
ProducerTemplate
sendBody in interface ProducerTemplate<E extends Exchange>endpointUri - the endpoint URI to send the exchange topattern - the message ExchangePattern such as
ExchangePattern.InOnly or ExchangePattern.InOutbody - the payload
public Object sendBodyAndHeader(String endpointUri,
Object body,
String header,
Object headerValue)
ProducerTemplate
sendBodyAndHeader in interface ProducerTemplate<E extends Exchange>endpointUri - the endpoint URI to send tobody - the payload to sendheader - the header nameheaderValue - the header value
public Object sendBodyAndHeader(Endpoint<E> endpoint,
Object body,
String header,
Object headerValue)
ProducerTemplate
sendBodyAndHeader in interface ProducerTemplate<E extends Exchange>endpoint - the Endpoint to send tobody - the payload to sendheader - the header nameheaderValue - the header value
public Object sendBodyAndHeader(Endpoint<E> endpoint,
ExchangePattern pattern,
Object body,
String header,
Object headerValue)
ProducerTemplate
sendBodyAndHeader in interface ProducerTemplate<E extends Exchange>endpoint - the Endpoint to send topattern - the message ExchangePattern such as
ExchangePattern.InOnly or ExchangePattern.InOutbody - the payload to sendheader - the header nameheaderValue - the header value
public Object sendBodyAndHeader(String endpoint,
ExchangePattern pattern,
Object body,
String header,
Object headerValue)
ProducerTemplate
sendBodyAndHeader in interface ProducerTemplate<E extends Exchange>endpoint - the Endpoint URI to send topattern - the message ExchangePattern such as
ExchangePattern.InOnly or ExchangePattern.InOutbody - the payload to sendheader - the header nameheaderValue - the header value
public Object sendBodyAndHeaders(String endpointUri,
Object body,
Map<String,Object> headers)
ProducerTemplate
sendBodyAndHeaders in interface ProducerTemplate<E extends Exchange>endpointUri - the endpoint URI to send tobody - the payload to sendheaders - headers
public Object sendBodyAndHeaders(Endpoint<E> endpoint,
Object body,
Map<String,Object> headers)
ProducerTemplate
sendBodyAndHeaders in interface ProducerTemplate<E extends Exchange>endpoint - the endpoint URI to send tobody - the payload to sendheaders - headers
public Object sendBodyAndHeaders(String endpointUri,
ExchangePattern pattern,
Object body,
Map<String,Object> headers)
ProducerTemplate
sendBodyAndHeaders in interface ProducerTemplate<E extends Exchange>endpointUri - the endpoint URI to send topattern - the message ExchangePattern such as
ExchangePattern.InOnly or ExchangePattern.InOutbody - the payload to sendheaders - headers
public Object sendBodyAndHeaders(Endpoint<E> endpoint,
ExchangePattern pattern,
Object body,
Map<String,Object> headers)
ProducerTemplate
sendBodyAndHeaders in interface ProducerTemplate<E extends Exchange>endpoint - the endpoint URI to send topattern - the message ExchangePattern such as
ExchangePattern.InOnly or ExchangePattern.InOutbody - the payload to sendheaders - headers
public E request(Endpoint<E> endpoint,
Processor processor)
ProducerTemplateExchangePattern.InOut message exchange pattern.
request in interface ProducerTemplate<E extends Exchange>endpoint - the Endpoint to send toprocessor - the processor which will populate the exchange before sending
public Object requestBody(Endpoint<E> endpoint,
Object body)
ProducerTemplateExchangePattern.InOut message exchange pattern.
requestBody in interface ProducerTemplate<E extends Exchange>endpoint - the Endpoint to send tobody - the payload
public Object requestBodyAndHeader(Endpoint<E> endpoint,
Object body,
String header,
Object headerValue)
ProducerTemplateExchangePattern.InOut message exchange pattern.
requestBodyAndHeader in interface ProducerTemplate<E extends Exchange>endpoint - the Endpoint to send tobody - the payloadheader - the header nameheaderValue - the header value
public E request(String endpoint,
Processor processor)
ProducerTemplateExchangePattern.InOut message exchange pattern.
request in interface ProducerTemplate<E extends Exchange>endpoint - the endpoint URI to send toprocessor - the processor which will populate the exchange before sending
public Object requestBody(String endpoint,
Object body)
ProducerTemplateExchangePattern.InOut message exchange pattern.
requestBody in interface ProducerTemplate<E extends Exchange>endpoint - the endpoint URI to send tobody - the payload
public Object requestBodyAndHeader(String endpoint,
Object body,
String header,
Object headerValue)
ProducerTemplateExchangePattern.InOut message exchange pattern.
requestBodyAndHeader in interface ProducerTemplate<E extends Exchange>endpoint - the endpoint URI to send tobody - the payloadheader - the header nameheaderValue - the header value
public Object requestBodyAndHeaders(String endpointUri,
Object body,
Map<String,Object> headers)
ProducerTemplateExchangePattern.InOut message exchange pattern.
requestBodyAndHeaders in interface ProducerTemplate<E extends Exchange>endpointUri - the endpoint URI to send tobody - the payload to sendheaders - headers
public Object requestBodyAndHeaders(Endpoint<E> endpoint,
Object body,
Map<String,Object> headers)
ProducerTemplateExchangePattern.InOut message exchange pattern.
requestBodyAndHeaders in interface ProducerTemplate<E extends Exchange>endpoint - the endpoint URI to send tobody - the payload to sendheaders - headers
public Object sendBody(Object body)
ProducerTemplate
sendBody in interface ProducerTemplate<E extends Exchange>body - the payload to send
public E send(E exchange)
ProducerTemplate
send in interface ProducerTemplate<E extends Exchange>exchange - the exchange to send
public E send(Processor processor)
ProducerTemplate
send in interface ProducerTemplate<E extends Exchange>processor - the transformer used to populate the new exchange
Processor to populate the exchange
public Object sendBodyAndHeader(Object body,
String header,
Object headerValue)
ProducerTemplate
sendBodyAndHeader in interface ProducerTemplate<E extends Exchange>body - the payload to sendheader - the header nameheaderValue - the header value
public Object sendBodyAndHeaders(Object body,
Map<String,Object> headers)
ProducerTemplate
sendBodyAndHeaders in interface ProducerTemplate<E extends Exchange>body - the payload to sendheaders - the headers
public Producer<E> getProducer(Endpoint<E> endpoint)
public CamelContext getContext()
public Endpoint<E> getDefaultEndpoint()
public void setDefaultEndpoint(Endpoint<E> defaultEndpoint)
public void setDefaultEndpointUri(String endpointUri)
public boolean isUseEndpointCache()
public void setUseEndpointCache(boolean useEndpointCache)
public <T extends Endpoint<?>> T getResolvedEndpoint(String endpointUri,
Class<T> expectedClass)
protected Processor createBodyAndHeaderProcessor(Object body,
String header,
Object headerValue)
protected Processor createSetBodyProcessor(Object body)
protected Endpoint resolveMandatoryEndpoint(String endpointUri)
protected Endpoint<E> getMandatoryDefaultEndpoint()
protected void doStart()
throws Exception
doStart in class ServiceSupportException
protected void doStop()
throws Exception
doStop in class ServiceSupportExceptionprotected Object extractResultBody(E result)
result - the result
protected Object extractResultBody(E result,
ExchangePattern pattern)
result - the resultpattern - exchange pattern if given, can be null
protected boolean hasFaultMessage(E result)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||