org.apache.camel
Interface PollingConsumer

All Superinterfaces:
Consumer, Service
All Known Implementing Classes:
EventDrivenPollingConsumer, PollingConsumerSupport, ProcessorPollingConsumer

public interface PollingConsumer
extends Consumer

Represents a Polling Consumer where the caller polls for messages when it is ready.

Version:

Method Summary
 Exchange receive()
          Waits until a message is available and then returns it.
 Exchange receive(long timeout)
          Attempts to receive a message exchange, waiting up to the given timeout to expire if a message is not yet available
 Exchange receiveNoWait()
          Attempts to receive a message exchange immediately without waiting and returning null if a message exchange is not available yet.
 
Methods inherited from interface org.apache.camel.Consumer
getEndpoint
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Method Detail

receive

Exchange receive()
Waits until a message is available and then returns it. Warning that this method could block indefinitely if no messages are available.

Will return null if the consumer is not started

Returns:
the message exchange received.

receiveNoWait

Exchange receiveNoWait()
Attempts to receive a message exchange immediately without waiting and returning null if a message exchange is not available yet.

Returns:
the message exchange if one is immediately available otherwise null

receive

Exchange receive(long timeout)
Attempts to receive a message exchange, waiting up to the given timeout to expire if a message is not yet available

Parameters:
timeout - the amount of time in milliseconds to wait for a message before timing out and returning null
Returns:
the message exchange if one iwas available within the timeout period, or null if the timeout expired


Apache CAMEL