Interface DynamicPollingConsumer
- All Superinterfaces:
AutoCloseable, Consumer, EndpointAware, PollingConsumer, Service
A
PollingConsumer used by the dynamic poll and pollEnrich EIPs, allowing the component to use
data from the current Exchange (such as headers or properties) to parameterise the poll operation at runtime.
Components that support dynamic polling implement this interface in addition to PollingConsumer to provide
exchange-aware overloads of the three receive methods.- Since:
- 4.11
- See Also:
-
Method Summary
Modifier and TypeMethodDescription@Nullable ExchangeWaits until a message is available and then returns it.@Nullable ExchangeAttempts to receive a message exchange, waiting up to the given timeout to expire if a message is not yet available.@Nullable ExchangereceiveNoWait(Exchange exchange) Attempts to receive a message exchange immediately without waiting and returning null if a message exchange is not available yet.Methods inherited from interface Consumer
createExchange, defaultConsumerCallback, getProcessor, releaseExchangeMethods inherited from interface EndpointAware
getEndpointMethods inherited from interface PollingConsumer
receive, receive, receiveNoWait
-
Method Details
-
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 Important: See the class javadoc about the need for done theUnitOfWorkon the returnedExchange- Parameters:
exchange- the current exchange- Returns:
- the message exchange received.
-
receiveNoWait
Attempts to receive a message exchange immediately without waiting and returning null if a message exchange is not available yet. Important: See the class javadoc about the need for done theUnitOfWorkon the returnedExchange- Returns:
- the message exchange if one is immediately available otherwise null
-
receive
Attempts to receive a message exchange, waiting up to the given timeout to expire if a message is not yet available. Important: See the class javadoc about the need for done theUnitOfWorkon the returnedExchange- 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 was available within the timeout period, or null if the timeout expired
-