Interface DynamicPollingConsumer

All Superinterfaces:
AutoCloseable, Consumer, EndpointAware, PollingConsumer, Service

public interface DynamicPollingConsumer extends PollingConsumer
A PollingConsumer that are used by dynamic Poll and PollEnrich EIPs to facilitate components that can use information from the current Exchange during the poll.
  • Method Details

    • receive

      Exchange receive(Exchange exchange)
      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 the UnitOfWork on the returned Exchange

      Parameters:
      exchange - the current exchange
      Returns:
      the message exchange received.
    • receiveNoWait

      Exchange receiveNoWait(Exchange exchange)
      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 the UnitOfWork on the returned Exchange

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

      Exchange receive(Exchange exchange, long timeout)
      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 the UnitOfWork on the returned Exchange

      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