|
||||||||||
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.CamelTemplate<E>
public class CamelTemplate<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 | |
---|---|
CamelTemplate(CamelContext context)
|
|
CamelTemplate(CamelContext context,
Endpoint defaultEndpoint)
|
Method Summary | |
---|---|
protected void |
doStart()
|
protected void |
doStop()
|
protected Object |
extractResultBody(E result)
|
CamelContext |
getContext()
|
Endpoint<E> |
getDefaultEndpoint()
|
protected Endpoint<E> |
getMandatoryDefaultEndpoint()
|
Producer<E> |
getProducer(Endpoint<E> endpoint)
|
boolean |
isUseEndpointCache()
|
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,
Processor processor)
Sends an exchange to an endpoint using a supplied |
E |
send(Processor processor)
Sends an exchange to the default endpoint using a supplied |
E |
send(String endpointUri,
E exchange)
Sends the exchange to the given endpoint |
E |
send(String endpointUri,
Processor processor)
Sends an exchange to an endpoint using a supplied |
Object |
sendBody(Endpoint<E> endpoint,
Object body)
Send the body to an endpoint |
Object |
sendBody(Object body)
Sends the body to the default endpoint and returns the result content |
Object |
sendBody(String endpointUri,
Object body)
Send the body to an endpoint |
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 endpointUri,
Object body,
String header,
Object headerValue)
Sends the body to an endpoint with a specified header and header value |
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,
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, isStarted, 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 CamelTemplate(CamelContext context)
public CamelTemplate(CamelContext context, Endpoint defaultEndpoint)
Method Detail |
---|
public E send(String endpointUri, E exchange)
send
in interface ProducerTemplate<E extends Exchange>
endpointUri
- the endpoint URI to send the exchange toexchange
- the exchange to sendpublic E send(String endpointUri, Processor processor)
send
in interface ProducerTemplate<E extends Exchange>
endpointUri
- the endpoint URI to send the exchange toprocessor
- the transformer used to populate the new exchangepublic E send(Endpoint<E> endpoint, E exchange)
send
in interface ProducerTemplate<E extends Exchange>
endpoint
- the endpoint to send the exchange toexchange
- the exchange to sendpublic E send(Endpoint<E> endpoint, Processor processor)
send
in interface ProducerTemplate<E extends Exchange>
endpoint
- the endpoint to send the exchange toprocessor
- the transformer used to populate the new exchangepublic Object sendBody(Endpoint<E> endpoint, Object body)
sendBody
in interface ProducerTemplate<E extends Exchange>
endpoint
- body
- = the payload
public Object sendBody(String endpointUri, Object body)
sendBody
in interface ProducerTemplate<E extends Exchange>
endpointUri
- body
- = the payload
public Object sendBodyAndHeader(String endpointUri, Object body, String header, Object headerValue)
endpointUri
- the endpoint URI to send tobody
- the payload sendheader
- the header nameheaderValue
- the header value
public Object sendBodyAndHeader(Endpoint endpoint, Object body, String header, Object headerValue)
endpoint
- the Endpoint to send tobody
- the payload sendheader
- the header nameheaderValue
- the header value
public Object sendBodyAndHeaders(String endpointUri, Object body, Map<String,Object> headers)
endpointUri
- the endpoint URI to send tobody
- the payload send
public Object sendBodyAndHeaders(Endpoint endpoint, Object body, Map<String,Object> headers)
endpoint
- the endpoint URI to send tobody
- the payload send
public Object sendBody(Object body)
sendBody
in interface ProducerTemplate<E extends Exchange>
body
- the body to send
public E send(E exchange)
send
in interface ProducerTemplate<E extends Exchange>
exchange
- the exchange to sendpublic E send(Processor processor)
send
in interface ProducerTemplate<E extends Exchange>
processor
- the transformer used to populate the new exchangepublic Object sendBodyAndHeader(Object body, String header, Object headerValue)
ProducerTemplate
sendBodyAndHeader
in interface ProducerTemplate<E extends Exchange>
body
- the payload 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 send
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)
protected Endpoint resolveMandatoryEndpoint(String endpointUri)
protected Endpoint<E> getMandatoryDefaultEndpoint()
protected void doStart() throws Exception
doStart
in class ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class ServiceSupport
Exception
protected Object extractResultBody(E result)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |