Class PollDefinition

All Implemented Interfaces:
org.apache.camel.CamelContextAware, org.apache.camel.LineNumberAware, Block, CopyableDefinition<ProcessorDefinition>, DisabledAwareDefinition, EndpointRequiredDefinition, org.apache.camel.NamedNode, org.apache.camel.spi.HasCamelContext, org.apache.camel.spi.HasId, org.apache.camel.spi.IdAware

@Metadata(label="eip,routing") public class PollDefinition extends NoOutputDefinition<PollDefinition> implements EndpointRequiredDefinition
Polls a message from a static endpoint
  • Field Details

    • endpoint

      protected org.apache.camel.Endpoint endpoint
    • endpointConsumerBuilder

      protected EndpointConsumerBuilder endpointConsumerBuilder
  • Constructor Details

    • PollDefinition

      public PollDefinition()
    • PollDefinition

      protected PollDefinition(PollDefinition source)
    • PollDefinition

      public PollDefinition(String uri)
    • PollDefinition

      public PollDefinition(org.apache.camel.Endpoint endpoint)
    • PollDefinition

      public PollDefinition(EndpointConsumerBuilder endpointDefinition)
  • Method Details

    • getShortName

      public String getShortName()
      Specified by:
      getShortName in interface org.apache.camel.NamedNode
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getVariableReceive

      public String getVariableReceive()
    • setVariableReceive

      public void setVariableReceive(String variableReceive)
      To use a variable to store the received message body (only body, not headers). This makes it handy to use variables for user data and to easily control what data to use for sending and receiving. Important: When using receive variable then the received body is stored only in this variable and not on the current message.
    • copyDefinition

      public PollDefinition copyDefinition()
      Description copied from interface: CopyableDefinition
      Makes a copy of this definition.
      Specified by:
      copyDefinition in interface CopyableDefinition<ProcessorDefinition>
    • getUri

      public String getUri()
    • setUri

      public void setUri(String uri)
      Sets the uri of the endpoint to poll from.
      Parameters:
      uri - the uri of the endpoint
    • getEndpoint

      public org.apache.camel.Endpoint getEndpoint()
      Gets the endpoint if an Endpoint instance was set.

      This implementation may return null which means you need to use getEndpointUri() to get information about the endpoint.

      Returns:
      the endpoint instance, or null
    • setEndpoint

      public void setEndpoint(org.apache.camel.Endpoint endpoint)
    • getTimeout

      public String getTimeout()
    • setTimeout

      public void setTimeout(String timeout)
      Timeout in millis when polling from the external service.

      The timeout has influence about the poll enrich behavior. It basically operations in three different modes:

      • negative value - Waits until a message is available and then returns it. Warning that this method could block indefinitely if no messages are available.
      • 0 - Attempts to receive a message exchange immediately without waiting and returning null if a message exchange is not available yet.
      • positive value - Attempts to receive a message exchange, waiting up to the given timeout to expire if a message is not yet available. Returns null if timed out
      The default value is 20000 (20 seconds).
    • getEndpointConsumerBuilder

      public EndpointConsumerBuilder getEndpointConsumerBuilder()
    • setEndpointConsumerBuilder

      public void setEndpointConsumerBuilder(EndpointConsumerBuilder endpointConsumerBuilder)
    • getEndpointUri

      public String getEndpointUri()
      Description copied from interface: EndpointRequiredDefinition
      Gets the uri of the endpoint used by this definition.
      Specified by:
      getEndpointUri in interface EndpointRequiredDefinition
    • getLabel

      public String getLabel()
      Description copied from class: ProcessorDefinition
      Returns a label to describe this node such as the expression if some kind of expression node
      Specified by:
      getLabel in interface org.apache.camel.NamedNode
      Overrides:
      getLabel in class ProcessorDefinition<PollDefinition>
    • clear

      protected void clear()