public class MqttListener extends MqttFacade implements ReceiverAware<org.eclipse.paho.client.mqttv3.MqttMessage>, IPushingListener<org.eclipse.paho.client.mqttv3.MqttMessage>, org.eclipse.paho.client.mqttv3.MqttCallbackExtended
client, connectOptions, log
Constructor and Description |
---|
MqttListener() |
Modifier and Type | Method and Description |
---|---|
void |
afterMessageProcessed(PipeLineResult processResult,
Object rawMessageOrWrapper,
Map<String,Object> context)
Called to perform actions (like committing or sending a reply) after a message has been processed by the
Pipeline.
|
void |
configure()
configure() is called once at startup of the framework in the configure() method
of the owner of this listener. |
void |
connectComplete(boolean reconnect,
String brokerUrl) |
void |
connectionLost(Throwable throwable) |
void |
deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token) |
Message |
extractMessage(org.eclipse.paho.client.mqttv3.MqttMessage rawMessage,
Map<String,Object> context)
Extracts string from message obtained from
IPullingListener.getRawMessage(Map) . |
String |
getIdFromRawMessage(org.eclipse.paho.client.mqttv3.MqttMessage rawMessage,
Map<String,Object> context)
Extracts ID-string from message obtained from
IPullingListener.getRawMessage(Map) . |
Receiver<org.eclipse.paho.client.mqttv3.MqttMessage> |
getReceiver() |
void |
messageArrived(String topic,
org.eclipse.paho.client.mqttv3.MqttMessage message) |
void |
open()
Prepares the listener for receiving messages.
|
void |
setExceptionListener(IbisExceptionListener ibisExceptionListener)
Set a (single) listener that will be notified of any exceptions.
|
void |
setHandler(IMessageHandler<org.eclipse.paho.client.mqttv3.MqttMessage> messageHandler)
Set the handler that will do the processing of the message.
|
void |
setReceiver(Receiver<org.eclipse.paho.client.mqttv3.MqttMessage> receiver) |
close, getLogPrefix, getPhysicalDestinationName, setAuthAlias, setAutomaticReconnect, setBrokerUrl, setCharset, setCleanSession, setClientId, setKeepAliveInterval, setName, setPassword, setPersistenceDirectory, setQos, setTimeout, setTopic, setUsername, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName, setName
getApplicationContext, getName
getConfigurationClassLoader
setApplicationContext
getDomain
public void setReceiver(Receiver<org.eclipse.paho.client.mqttv3.MqttMessage> receiver)
setReceiver
in interface ReceiverAware<org.eclipse.paho.client.mqttv3.MqttMessage>
public Receiver<org.eclipse.paho.client.mqttv3.MqttMessage> getReceiver()
getReceiver
in interface ReceiverAware<org.eclipse.paho.client.mqttv3.MqttMessage>
public void setHandler(IMessageHandler<org.eclipse.paho.client.mqttv3.MqttMessage> messageHandler)
IPushingListener
setHandler
in interface IPushingListener<org.eclipse.paho.client.mqttv3.MqttMessage>
public void setExceptionListener(IbisExceptionListener ibisExceptionListener)
IPushingListener
setExceptionListener
in interface IPushingListener<org.eclipse.paho.client.mqttv3.MqttMessage>
public void configure() throws ConfigurationException
IListener
configure()
is called once at startup of the framework in the configure()
method
of the owner of this listener.
Purpose of this method is to reduce creating connections to databases etc. in the IPullingListener.getRawMessage(Map)
method.
As much as possible class-instantiating should take place in the
configure()
or open()
method, to improve performance.configure
in interface IConfigurable
configure
in interface IListener<org.eclipse.paho.client.mqttv3.MqttMessage>
configure
in class MqttFacade
ConfigurationException
public void open() throws ListenerException
IListener
open()
is called once each time the listener is started.open
in interface IListener<org.eclipse.paho.client.mqttv3.MqttMessage>
open
in class MqttFacade
ListenerException
public void connectComplete(boolean reconnect, String brokerUrl)
connectComplete
in interface org.eclipse.paho.client.mqttv3.MqttCallbackExtended
public void connectionLost(Throwable throwable)
connectionLost
in interface org.eclipse.paho.client.mqttv3.MqttCallback
public void deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token)
deliveryComplete
in interface org.eclipse.paho.client.mqttv3.MqttCallback
public void messageArrived(String topic, org.eclipse.paho.client.mqttv3.MqttMessage message) throws Exception
messageArrived
in interface org.eclipse.paho.client.mqttv3.MqttCallback
Exception
public String getIdFromRawMessage(org.eclipse.paho.client.mqttv3.MqttMessage rawMessage, Map<String,Object> context) throws ListenerException
IListener
IPullingListener.getRawMessage(Map)
. May also extract
other parameters from the message and put those in the context.
getIdFromRawMessage
in interface IListener<org.eclipse.paho.client.mqttv3.MqttMessage>
ListenerException
public Message extractMessage(org.eclipse.paho.client.mqttv3.MqttMessage rawMessage, Map<String,Object> context) throws ListenerException
IListener
IPullingListener.getRawMessage(Map)
. May also extract
other parameters from the message and put those in the threadContext.extractMessage
in interface IListener<org.eclipse.paho.client.mqttv3.MqttMessage>
ListenerException
public void afterMessageProcessed(PipeLineResult processResult, Object rawMessageOrWrapper, Map<String,Object> context) throws ListenerException
IListener
afterMessageProcessed
in interface IListener<org.eclipse.paho.client.mqttv3.MqttMessage>
ListenerException
Copyright © 2023 Frank!Framework. All rights reserved.