Class MqttSender

java.lang.Object
org.frankframework.extensions.mqtt.MqttFacade
org.frankframework.extensions.mqtt.MqttSender
All Implemented Interfaces:
FrankElement, HasApplicationContext, HasName, HasPhysicalDestination, IConfigurable, IScopeProvider, ISender, ISenderWithParameters, IWithParameters, NameAware, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

public class MqttSender extends MqttFacade implements ISenderWithParameters
MQTT listener which will connect to a broker and subscribe to a topic. Links to https://www.eclipse.org/paho/files/javadoc are opened in a new window/tab because the response from eclipse.org contains header X-Frame-Options:SAMEORIGIN which will make the browser refuse to open the link inside this frame.
Author:
Niels Meijer
  • Field Details

  • Constructor Details

    • MqttSender

      public MqttSender()
  • Method Details

    • 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
      Overrides:
      configure in class MqttFacade
      Throws:
      ConfigurationException - in case it was not able to configure the component.
    • start

      public void start()
      Description copied from interface: ISender
      This method will be called to start the sender. After this method is called the sendMessage method may be called. Purpose of this method is to reduce creating connections to databases etc. in the sendMessage() method.
      Specified by:
      start in interface ISender
    • stop

      public void stop()
      Description copied from interface: ISender
      Stop/close the sender and deallocate resources.
      Specified by:
      stop in interface ISender
    • addParameter

      public void addParameter(IParameter p)
      Specified by:
      addParameter in interface IWithParameters
    • getParameterList

      @Nonnull public ParameterList getParameterList()
      Specified by:
      getParameterList in interface IWithParameters
    • sendMessage

      @Nonnull public SenderResult sendMessage(@Nonnull Message message, @Nonnull PipeLineSession session) throws SenderException, TimeoutException
      Description copied from interface: ISender
      Send a message to some destination (as configured in the Sender object). This method may only be called after the configure() method is called.

      The following table shows the difference between synchronous and a-synchronous senders:

       synchronousa-synchronous
      ISender.isSynchronous() returnstruefalse
      return value of sendMessage() isthe reply-messagethe messageId of the message sent
      the correlationID specified with sendMessage()may be ignoredis sent with the message
      a {link TimeOutException}may be thrown if a timeout occurs waiting for a replyshould not be expected

      Multiple objects may try to call this method at the same time, from different threads. Implementations of this method should therefore be thread-safe, or synchronized.

      Specified by:
      sendMessage in interface ISender
      Throws:
      SenderException
      TimeoutException
    • setTopic

      @Optional public void setTopic(String topic)
      see MqttClient.subscribe(java.lang.String topicFilter) Can be dynamically set using the "topic" parameter.
      Overrides:
      setTopic in class MqttFacade
    • isSynchronous

      public boolean isSynchronous()
      Description copied from interface: ISender
      When true, the result of sendMessage is the reply of the request.
      Specified by:
      isSynchronous in interface ISender