Class AmqpListener

java.lang.Object
org.frankframework.messaging.amqp.AmqpListener
All Implemented Interfaces:
FrankElement, HasApplicationContext, HasName, IConfigurable, IListener<org.apache.qpid.protonj2.client.Message<?>>, IPushingListener<org.apache.qpid.protonj2.client.Message<?>>, IScopeProvider, IThreadCountControllable, NameAware, RequestReplyListener, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Category(EXPERIMENTAL) @DestinationType(AMQP) public class AmqpListener extends Object implements IPushingListener<org.apache.qpid.protonj2.client.Message<?>>, IThreadCountControllable, RequestReplyListener
Listener for AMQP 1.0 end-points.
  • Field Details

    • DEFAULT_TIMEOUT_SECONDS

      public static final long DEFAULT_TIMEOUT_SECONDS
      See Also:
    • DEFAULT_TIME_TO_LIVE

      public static final long DEFAULT_TIME_TO_LIVE
  • Constructor Details

    • AmqpListener

      public AmqpListener()
  • Method Details

    • wrapRawMessage

      public RawMessageWrapper<org.apache.qpid.protonj2.client.Message<?>> wrapRawMessage(org.apache.qpid.protonj2.client.Message<?> rawMessage, PipeLineSession session) throws ListenerException
      Description copied from interface: IPushingListener
      Wrap a raw message in a MessageWrapper. Populate PipeLineSession with properties from the message.
      Specified by:
      wrapRawMessage in interface IPushingListener<org.apache.qpid.protonj2.client.Message<?>>
      Parameters:
      rawMessage - The raw message data, unwrapped
      session - PipeLineSession to populate with properties from the message.
      Returns:
      Wrapped raw message
      Throws:
      ListenerException - If any exception occurs during wrapping, a ListenerException is thrown.
    • configure

      public void configure() throws ConfigurationException
      Description copied from interface: IConfigurable
      Configure this component.

      configure() is called once at startup of the framework in the configure method of the owner of this IConfigurable. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in the configure(), to improve performance.

      In the case of a container, this will propagate the configure signal to all components that apply.

      Specified by:
      configure in interface IConfigurable
      Throws:
      ConfigurationException - in case it was not able to configure the component.
    • start

      public void start()
      Description copied from interface: IListener
      Prepares the listener for receiving messages. start() is called once each time the listener is started.
      Specified by:
      start in interface IListener<org.apache.qpid.protonj2.client.Message<?>>
    • stop

      public void stop()
      Description copied from interface: IListener
      Close all resources used for listening. Called once each time the listener is stopped.
      Specified by:
      stop in interface IListener<org.apache.qpid.protonj2.client.Message<?>>
    • extractMessage

      public Message extractMessage(@Nonnull RawMessageWrapper<org.apache.qpid.protonj2.client.Message<?>> rawMessage, @Nonnull Map<String,Object> context) throws ListenerException
      Description copied from interface: IListener
      Extracts data from message obtained from IPullingListener.getRawMessage(Map) or IPushingListener.wrapRawMessage(Object, PipeLineSession). May also extract other parameters from the message and put those into the context.
      Specified by:
      extractMessage in interface IListener<org.apache.qpid.protonj2.client.Message<?>>
      Parameters:
      rawMessage - The RawMessageWrapper from which to extract the Message.
      context - Context to populate. Either a PipeLineSession or a Map threadContext depending on caller.
      Returns:
      input Message for adapter.
      Throws:
      ListenerException
    • afterMessageProcessed

      public void afterMessageProcessed(PipeLineResult processResult, RawMessageWrapper<org.apache.qpid.protonj2.client.Message<?>> rawMessage, PipeLineSession pipeLineSession) throws ListenerException
      Description copied from interface: IListener
      Called to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.
      Specified by:
      afterMessageProcessed in interface IListener<org.apache.qpid.protonj2.client.Message<?>>
      Throws:
      ListenerException
    • setConnectionName

      public void setConnectionName(String connectionName)
      Name of the AMQP connection in the amqp section of the resources.yaml file.
    • setSendReplyTimeout

      public void setSendReplyTimeout(long timeout)
      Timeout in seconds for sending messages and receiving replies.
      Default value
      30L
    • setAddressType

      public void setAddressType(AddressType addressType)
      Set the type of address to which messages are being sent, TOPIC or QUEUE. For MessageProtocol#RR the type will always be QUEUE.
      Default value
      QUEUE
    • setAddress

      public void setAddress(String address)
      Set the address (name of the queue or topic) on which to send messages
    • setReplyAddress

      public void setReplyAddress(String replyAddress)
      If the adapter needs to send a reply message, and the address of the reply-queue is not dynamically set on the message, then a replyAddressName can be configured for the queue on which to send the reply message. If a replyAddressName is configured but the message does have a dynamic reply-queue, then the dynamic reply-queue is used and the replyAddressName is ignored.
    • setDurable

      public void setDurable(boolean durable)
      If true, then listen for durable messages on a topic
    • setReplyTimeToLive

      public void setReplyTimeToLive(long timeToLive)
      Set the message time-to-live, in milliseconds, for any reply messages sent by this listener.
      Default value
      -1ms, meaning no expiry.
    • setDeliveryMode

      public void setDeliveryMode(org.apache.qpid.protonj2.client.DeliveryMode deliveryMode)
      DeliveryMode: AT_LEAST_ONCE or AT_MOST_ONCE.
      Default value
      AT_LEAST_ONCE
    • setMessageProtocol

      public void setMessageProtocol(MessageProtocol messageProtocol)
      Receive message as Fire-and-Forget, or as Request-Reply
      Parameters:
      messageProtocol - FF for Fire-and-Forget, or RR for Request-Reply.
      Default value
      FF
    • setSubscriptionName

      public void setSubscriptionName(String subscriptionName)
      When the listener is durable, then a subscriptionName should be set so the message broker can keep track of which subscribers have already received each message.
    • setMaxThreadCount

      public void setMaxThreadCount(int maxThreadCount)
    • isThreadCountReadable

      public boolean isThreadCountReadable()
      Specified by:
      isThreadCountReadable in interface IThreadCountControllable
    • isThreadCountControllable

      public boolean isThreadCountControllable()
      Specified by:
      isThreadCountControllable in interface IThreadCountControllable
    • getCurrentThreadCount

      public int getCurrentThreadCount()
      Specified by:
      getCurrentThreadCount in interface IThreadCountControllable
    • getMaxThreadCount

      public int getMaxThreadCount()
      Specified by:
      getMaxThreadCount in interface IThreadCountControllable
    • increaseThreadCount

      public void increaseThreadCount()
      Specified by:
      increaseThreadCount in interface IThreadCountControllable
    • decreaseThreadCount

      public void decreaseThreadCount()
      Specified by:
      decreaseThreadCount in interface IThreadCountControllable
    • setOnException

      public void setOnException(RequestReplyListener.ExceptionHandlingMethod method)
      Description copied from interface: RequestReplyListener
      When an exception happens in the execution of the pipeline, with RETHROW the exception is thrown to the caller. With FORMAT_AND_RETURN the exception is processed by the Adapter.setErrorMessageFormatter(IErrorMessageFormatter) and returned as result-message of the Adapter.
      The default is currently RETHROW for backwards compatibility but will become FORMAT_AND_RETURN in a future version.
      Specified by:
      setOnException in interface RequestReplyListener
      Parameters:
      method - RETHROW or FORMAT_AND_RETURN
    • getOnException

      Specified by:
      getOnException in interface RequestReplyListener