public class MqttPahoMessageHandler extends AbstractMqttMessageHandler implements org.eclipse.paho.client.mqttv3.MqttCallback, ApplicationEventPublisherAware
loggerHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
MqttPahoMessageHandler(String clientId,
MqttPahoClientFactory clientFactory)
Use this constructor if the server URI(s) are provided by the
MqttConnectOptions.getServerURIs()
provided by the MqttPahoClientFactory. |
MqttPahoMessageHandler(String url,
String clientId)
Use this URL when you don't need additional
MqttConnectOptions. |
MqttPahoMessageHandler(String url,
String clientId,
MqttPahoClientFactory clientFactory)
Use this constructor for a single url (although it may be overridden
if the server URI(s) are provided by the
MqttConnectOptions.getServerURIs()
provided by the MqttPahoClientFactory). |
| Modifier and Type | Method and Description |
|---|---|
protected void |
connectIfNeeded() |
void |
connectionLost(Throwable cause) |
void |
deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token) |
protected void |
doStart() |
protected void |
doStop() |
void |
messageArrived(String topic,
org.eclipse.paho.client.mqttv3.MqttMessage message) |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected void |
publish(String topic,
Object mqttMessage,
Message<?> message) |
void |
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) |
void |
setAsync(boolean async)
Set to true if you don't want to block when sending messages.
|
void |
setAsyncEvents(boolean asyncEvents)
When
setAsync(boolean) is true, setting this to true enables
publication of MqttMessageSentEvent and MqttMessageDeliveredEvent
to be emitted. |
void |
setCompletionTimeout(int completionTimeout)
Set the completion timeout for async operations.
|
getClientId, getClientInstance, getComponentType, getConverter, getUrl, handleMessageInternal, incrementClientInstance, isRunning, setConverter, setDefaultQos, setDefaultRetained, setDefaultTopic, start, stopgetOrder, handleMessage, setOrder, setShouldTrackafterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setMessageBuilderFactory, setTaskScheduler, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetComponentNamepublic MqttPahoMessageHandler(String url, String clientId, MqttPahoClientFactory clientFactory)
MqttConnectOptions.getServerURIs()
provided by the MqttPahoClientFactory).url - the URL.clientId - The client id.clientFactory - The client factory.public MqttPahoMessageHandler(String clientId, MqttPahoClientFactory clientFactory)
MqttConnectOptions.getServerURIs()
provided by the MqttPahoClientFactory.clientId - The client id.clientFactory - The client factory.public void setAsync(boolean async)
async - true for async.public void setAsyncEvents(boolean asyncEvents)
setAsync(boolean) is true, setting this to true enables
publication of MqttMessageSentEvent and MqttMessageDeliveredEvent
to be emitted. Default false.asyncEvents - the asyncEvents.public void setCompletionTimeout(int completionTimeout)
completionTimeout - The timeout.public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface ApplicationEventPublisherAwareprotected void onInit()
throws Exception
IntegrationObjectSupportonInit in class AbstractMqttMessageHandlerException - Any exception.protected void doStart()
doStart in class AbstractMqttMessageHandlerprotected void doStop()
doStop in class AbstractMqttMessageHandlerprotected void connectIfNeeded()
connectIfNeeded in class AbstractMqttMessageHandlerprotected void publish(String topic, Object mqttMessage, Message<?> message) throws Exception
publish in class AbstractMqttMessageHandlerExceptionpublic void connectionLost(Throwable cause)
connectionLost in interface org.eclipse.paho.client.mqttv3.MqttCallbackpublic void messageArrived(String topic, org.eclipse.paho.client.mqttv3.MqttMessage message) throws Exception
messageArrived in interface org.eclipse.paho.client.mqttv3.MqttCallbackExceptionpublic void deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token)
deliveryComplete in interface org.eclipse.paho.client.mqttv3.MqttCallback