org.apache.camel.impl
Class DefaultConsumerTemplate

java.lang.Object
  extended by org.apache.camel.impl.DefaultConsumerTemplate
All Implemented Interfaces:
ConsumerTemplate, Service

public class DefaultConsumerTemplate
extends Object
implements ConsumerTemplate

Version:
$Revision: 800392 $

Constructor Summary
DefaultConsumerTemplate(CamelContext context)
           
 
Method Summary
protected  Object extractResultBody(Exchange result)
          Extracts the body from the given result.
 CamelContext getCamelContext()
           
 Exchange receive(Endpoint endpoinit)
          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.
protected  Endpoint resolveMandatoryEndpoint(String endpointUri)
           
 void start()
          Starts the service
 void stop()
          Stops the service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConsumerTemplate

public DefaultConsumerTemplate(CamelContext context)
Method Detail

start

public void start()
           throws Exception
Description copied from interface: Service
Starts the service

Specified by:
start in interface Service
Throws:
Exception

stop

public void stop()
          throws Exception
Description copied from interface: Service
Stops the service

Specified by:
stop in interface Service
Throws:
Exception

getCamelContext

public CamelContext getCamelContext()

receive

public Exchange receive(String endpointUri)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, waiting until there is a response

Specified by:
receive in interface ConsumerTemplate
Parameters:
endpointUri - the endpoint to receive from
Returns:
the returned exchange

receive

public Exchange receive(Endpoint endpoinit)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, waiting until there is a response

Specified by:
receive in interface ConsumerTemplate
Parameters:
endpoinit - the endpoint to receive from
Returns:
the returned exchange

receive

public Exchange receive(String endpointUri,
                        long timeout)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, waiting until there is a response or the timeout occurs

Specified by:
receive in interface ConsumerTemplate
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

public Exchange receive(Endpoint endpoint,
                        long timeout)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, waiting until there is a response or the timeout occurs

Specified by:
receive in interface ConsumerTemplate
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

public Exchange receiveNoWait(String endpointUri)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, not waiting for a response if non exists.

Specified by:
receiveNoWait in interface ConsumerTemplate
Parameters:
endpointUri - the endpoint to receive from
Returns:
the returned exchange, or null if no response

receiveNoWait

public Exchange receiveNoWait(Endpoint endpoint)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, not waiting for a response if non exists.

Specified by:
receiveNoWait in interface ConsumerTemplate
Parameters:
endpoint - the endpoint to receive from
Returns:
the returned exchange, or null if no response

receiveBody

public Object receiveBody(String endpointUri)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, waiting until there is a response

Specified by:
receiveBody in interface ConsumerTemplate
Parameters:
endpointUri - the endpoint to receive from
Returns:
the returned response body

receiveBody

public Object receiveBody(Endpoint endpoint)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, waiting until there is a response

Specified by:
receiveBody in interface ConsumerTemplate
Parameters:
endpoint - the endpoint to receive from
Returns:
the returned response body

receiveBody

public Object receiveBody(String endpointUri,
                          long timeout)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, waiting until there is a response or the timeout occurs

Specified by:
receiveBody in interface ConsumerTemplate
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

public Object receiveBody(Endpoint endpoint,
                          long timeout)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, waiting until there is a response or the timeout occurs

Specified by:
receiveBody in interface ConsumerTemplate
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

public Object receiveBodyNoWait(String endpointUri)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, not waiting for a response if non exists.

Specified by:
receiveBodyNoWait in interface ConsumerTemplate
Parameters:
endpointUri - the endpoint to receive from
Returns:
the returned response body, or null if no response

receiveBodyNoWait

public Object receiveBodyNoWait(Endpoint endpoint)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, not waiting for a response if non exists.

Specified by:
receiveBodyNoWait in interface ConsumerTemplate
Parameters:
endpoint - the endpoint to receive from
Returns:
the returned response body, or null if no response

receiveBody

public <T> T receiveBody(String endpointUri,
                         Class<T> type)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, waiting until there is a response

Specified by:
receiveBody in interface ConsumerTemplate
Parameters:
endpointUri - the endpoint to receive from
type - the expected response type
Returns:
the returned response body

receiveBody

public <T> T receiveBody(Endpoint endpoint,
                         Class<T> type)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, waiting until there is a response

Specified by:
receiveBody in interface ConsumerTemplate
Parameters:
endpoint - the endpoint to receive from
type - the expected response type
Returns:
the returned response body

receiveBody

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

Specified by:
receiveBody in interface ConsumerTemplate
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

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

Specified by:
receiveBody in interface ConsumerTemplate
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

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

Specified by:
receiveBodyNoWait in interface ConsumerTemplate
Parameters:
endpointUri - the endpoint to receive from
type - the expected response type
Returns:
the returned response body, or null if no response

receiveBodyNoWait

public <T> T receiveBodyNoWait(Endpoint endpoint,
                               Class<T> type)
Description copied from interface: ConsumerTemplate
Receives from the endpoint, not waiting for a response if non exists.

Specified by:
receiveBodyNoWait in interface ConsumerTemplate
Parameters:
endpoint - the endpoint to receive from
type - the expected response type
Returns:
the returned response body, or null if no response

resolveMandatoryEndpoint

protected Endpoint resolveMandatoryEndpoint(String endpointUri)

extractResultBody

protected Object extractResultBody(Exchange result)
Extracts the body from the given result.

If the exchange pattern is provided it will try to honor it and retrive the body from either IN or OUT according to the pattern.

Parameters:
result - the result
Returns:
the result, can be null.


Apache CAMEL