org.apache.camel
Interface ConsumerTemplate

All Superinterfaces:
Service
All Known Implementing Classes:
DefaultConsumerTemplate

public interface ConsumerTemplate
extends Service

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

This template is an implementation of the Polling Consumer EIP. This is not the Event Driven Consumer EIP.

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

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

Important note on usage: See this FAQ entry before using, it applies to ConsumerTemplate as well.

Version:
$Revision: 759657 $

Method Summary
 Exchange receive(Endpoint endpoint)
          Receives from the endpoint, waiting until there is a response
 Exchange receive(Endpoint endpoint, long timeout)
          Receives from the endpoint, waiting until there is a response or the timeout occurs
 Exchange receive(String endpointUri)
          Receives from the endpoint, waiting until there is a response
 Exchange receive(String endpointUri, long timeout)
          Receives from the endpoint, waiting until there is a response or the timeout occurs
 Object receiveBody(Endpoint endpoint)
          Receives from the endpoint, waiting until there is a response
<T> T
receiveBody(Endpoint endpoint, Class<T> type)
          Receives from the endpoint, waiting until there is a response
 Object receiveBody(Endpoint endpoint, long timeout)
          Receives from the endpoint, waiting until there is a response or the timeout occurs
<T> T
receiveBody(Endpoint endpoint, long timeout, Class<T> type)
          Receives from the endpoint, waiting until there is a response or the timeout occurs
 Object receiveBody(String endpointUri)
          Receives from the endpoint, waiting until there is a response
<T> T
receiveBody(String endpointUri, Class<T> type)
          Receives from the endpoint, waiting until there is a response
 Object receiveBody(String endpointUri, long timeout)
          Receives from the endpoint, waiting until there is a response or the timeout occurs
<T> T
receiveBody(String endpointUri, long timeout, Class<T> type)
          Receives from the endpoint, waiting until there is a response or the timeout occurs
 Object receiveBodyNoWait(Endpoint endpoint)
          Receives from the endpoint, not waiting for a response if non exists.
<T> T
receiveBodyNoWait(Endpoint endpoint, Class<T> type)
          Receives from the endpoint, not waiting for a response if non exists.
 Object receiveBodyNoWait(String endpointUri)
          Receives from the endpoint, not waiting for a response if non exists.
<T> T
receiveBodyNoWait(String endpointUri, Class<T> type)
          Receives from the endpoint, not waiting for a response if non exists.
 Exchange receiveNoWait(Endpoint endpoint)
          Receives from the endpoint, not waiting for a response if non exists.
 Exchange receiveNoWait(String endpointUri)
          Receives from the endpoint, not waiting for a response if non exists.
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Method Detail

receive

Exchange receive(String endpointUri)
Receives from the endpoint, waiting until there is a response

Parameters:
endpointUri - the endpoint to receive from
Returns:
the returned exchange

receive

Exchange receive(Endpoint endpoint)
Receives from the endpoint, waiting until there is a response

Parameters:
endpoint - the endpoint to receive from
Returns:
the returned exchange

receive

Exchange receive(String endpointUri,
                 long timeout)
Receives from the endpoint, waiting until there is a response or the timeout occurs

Parameters:
endpointUri - the endpoint to receive from
timeout - timeout in millis to wait for a response
Returns:
the returned exchange, or null if no response

receive

Exchange receive(Endpoint endpoint,
                 long timeout)
Receives from the endpoint, waiting until there is a response or the timeout occurs

Parameters:
endpoint - the endpoint to receive from
timeout - timeout in millis to wait for a response
Returns:
the returned exchange, or null if no response

receiveNoWait

Exchange receiveNoWait(String endpointUri)
Receives from the endpoint, not waiting for a response if non exists.

Parameters:
endpointUri - the endpoint to receive from
Returns:
the returned exchange, or null if no response

receiveNoWait

Exchange receiveNoWait(Endpoint endpoint)
Receives from the endpoint, not waiting for a response if non exists.

Parameters:
endpoint - the endpoint to receive from
Returns:
the returned exchange, or null if no response

receiveBody

Object receiveBody(String endpointUri)
Receives from the endpoint, waiting until there is a response

Parameters:
endpointUri - the endpoint to receive from
Returns:
the returned response body

receiveBody

Object receiveBody(Endpoint endpoint)
Receives from the endpoint, waiting until there is a response

Parameters:
endpoint - the endpoint to receive from
Returns:
the returned response body

receiveBody

Object receiveBody(String endpointUri,
                   long timeout)
Receives from the endpoint, waiting until there is a response or the timeout occurs

Parameters:
endpointUri - the endpoint to receive from
timeout - timeout in millis to wait for a response
Returns:
the returned response body, or null if no response

receiveBody

Object receiveBody(Endpoint endpoint,
                   long timeout)
Receives from the endpoint, waiting until there is a response or the timeout occurs

Parameters:
endpoint - the endpoint to receive from
timeout - timeout in millis to wait for a response
Returns:
the returned response body, or null if no response

receiveBodyNoWait

Object receiveBodyNoWait(String endpointUri)
Receives from the endpoint, not waiting for a response if non exists.

Parameters:
endpointUri - the endpoint to receive from
Returns:
the returned response body, or null if no response

receiveBodyNoWait

Object receiveBodyNoWait(Endpoint endpoint)
Receives from the endpoint, not waiting for a response if non exists.

Parameters:
endpoint - the endpoint to receive from
Returns:
the returned response body, or null if no response

receiveBody

<T> T receiveBody(String endpointUri,
                  Class<T> type)
Receives from the endpoint, waiting until there is a response

Parameters:
endpointUri - the endpoint to receive from
type - the expected response type
Returns:
the returned response body

receiveBody

<T> T receiveBody(Endpoint endpoint,
                  Class<T> type)
Receives from the endpoint, waiting until there is a response

Parameters:
endpoint - the endpoint to receive from
type - the expected response type
Returns:
the returned response body

receiveBody

<T> T receiveBody(String endpointUri,
                  long timeout,
                  Class<T> type)
Receives from the endpoint, waiting until there is a response or the timeout occurs

Parameters:
endpointUri - the endpoint to receive from
timeout - timeout in millis to wait for a response
type - the expected response type
Returns:
the returned response body, or null if no response

receiveBody

<T> T receiveBody(Endpoint endpoint,
                  long timeout,
                  Class<T> type)
Receives from the endpoint, waiting until there is a response or the timeout occurs

Parameters:
endpoint - the endpoint to receive from
timeout - timeout in millis to wait for a response
type - the expected response type
Returns:
the returned response body, or null if no response

receiveBodyNoWait

<T> T receiveBodyNoWait(String endpointUri,
                        Class<T> type)
Receives from the endpoint, not waiting for a response if non exists.

Parameters:
endpointUri - the endpoint to receive from
type - the expected response type
Returns:
the returned response body, or null if no response

receiveBodyNoWait

<T> T receiveBodyNoWait(Endpoint endpoint,
                        Class<T> type)
Receives from the endpoint, not waiting for a response if non exists.

Parameters:
endpoint - the endpoint to receive from
type - the expected response type
Returns:
the returned response body, or null if no response


Apache CAMEL