public class MqttPahoMessageDrivenChannelAdapter extends AbstractMqttMessageDrivenChannelAdapter implements org.eclipse.paho.client.mqttv3.MqttCallback, MqttPahoComponent, ApplicationEventPublisherAware
MqttIntegrationEvents
published by this component use MqttPahoComponent adapter = event.getSourceAsType() to get a
reference, allowing you to obtain the bean name and MqttConnectOptions. This
technique allows consumption of events from both inbound and outbound endpoints in the
same event listener.| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_COMPLETION_TIMEOUT
The default completion timeout in milliseconds.
|
static long |
DISCONNECT_COMPLETION_TIMEOUT
The default disconnect completion timeout in milliseconds.
|
topicLocklifecycleCondition, lifecycleLockEXPRESSION_PARSER, loggerDEFAULT_PHASE| Constructor and Description |
|---|
MqttPahoMessageDrivenChannelAdapter(String clientId,
MqttPahoClientFactory clientFactory,
String... topic)
Use this constructor if the server URI(s) are provided by the
MqttConnectOptions.getServerURIs() provided by the
MqttPahoClientFactory. |
MqttPahoMessageDrivenChannelAdapter(String url,
String clientId,
MqttPahoClientFactory clientFactory,
String... topic)
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). |
MqttPahoMessageDrivenChannelAdapter(String url,
String clientId,
String... topic)
Use this constructor when you don't need additional
MqttConnectOptions. |
| Modifier and Type | Method and Description |
|---|---|
void |
addTopic(String topic,
int qos)
Add a topic to the subscribed list.
|
void |
connectionLost(Throwable cause) |
void |
deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token) |
protected void |
doStart()
Take no action by default.
|
protected void |
doStop()
Take no action by default.
|
org.eclipse.paho.client.mqttv3.MqttConnectOptions |
getConnectionInfo()
Return information about the connection.
|
void |
messageArrived(String topic,
org.eclipse.paho.client.mqttv3.MqttMessage mqttMessage) |
void |
removeTopic(String... topic)
Remove a topic (or topics) from the subscribed list.
|
void |
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) |
void |
setCompletionTimeout(long completionTimeout)
Set the completion timeout for operations.
|
void |
setDisconnectCompletionTimeout(long completionTimeout)
Set the completion timeout when disconnecting.
|
void |
setManualAcks(boolean manualAcks)
Set the acknowledgment mode to manual.
|
void |
setRecoveryInterval(int recoveryInterval)
The time (ms) to wait between reconnection attempts.
|
addTopic, addTopics, getClientId, getComponentType, getConverter, getQos, getTopic, getUrl, onInit, setConverter, setQosafterSingletonsInstantiated, buildErrorMessage, getErrorChannel, getErrorMessageAttributes, getIntegrationPatternType, getMessagingTemplate, getOutputChannel, sendErrorMessageIfNecessary, sendMessage, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setOutputChannel, setOutputChannelName, setSendTimeout, setShouldTrack, subscribeToPublisherdestroy, doStop, getPhase, getRole, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBeanNamesetBeanNamegetBeanName, getComponentNamepublic static final long DEFAULT_COMPLETION_TIMEOUT
public static final long DISCONNECT_COMPLETION_TIMEOUT
public MqttPahoMessageDrivenChannelAdapter(String url, String clientId, MqttPahoClientFactory clientFactory, String... topic)
MqttConnectOptions.getServerURIs() provided by
the MqttPahoClientFactory).url - the URL.clientId - The client id.clientFactory - The client factory.topic - The topic(s).public MqttPahoMessageDrivenChannelAdapter(String clientId, MqttPahoClientFactory clientFactory, String... topic)
MqttConnectOptions.getServerURIs() provided by the
MqttPahoClientFactory.clientId - The client id.clientFactory - The client factory.topic - The topic(s).public void setCompletionTimeout(long completionTimeout)
completionTimeout - The timeout.public void setDisconnectCompletionTimeout(long completionTimeout)
completionTimeout - The timeout.public void setRecoveryInterval(int recoveryInterval)
recoveryInterval - the interval.public void setManualAcks(boolean manualAcks)
manualAcks - true for manual acks.public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface ApplicationEventPublisherAwarepublic org.eclipse.paho.client.mqttv3.MqttConnectOptions getConnectionInfo()
MqttComponentgetConnectionInfo in interface MqttComponent<org.eclipse.paho.client.mqttv3.MqttConnectOptions>getConnectionInfo in interface MqttPahoComponentprotected void doStart()
MessageProducerSupportdoStart in class MessageProducerSupportprotected void doStop()
MessageProducerSupportdoStop in class MessageProducerSupportpublic void addTopic(String topic, int qos)
AbstractMqttMessageDrivenChannelAdapteraddTopic in class AbstractMqttMessageDrivenChannelAdaptertopic - The topic.qos - The qos.public void removeTopic(String... topic)
AbstractMqttMessageDrivenChannelAdapterremoveTopic in class AbstractMqttMessageDrivenChannelAdaptertopic - The topic.public void connectionLost(Throwable cause)
connectionLost in interface org.eclipse.paho.client.mqttv3.MqttCallbackpublic void messageArrived(String topic, org.eclipse.paho.client.mqttv3.MqttMessage mqttMessage)
messageArrived in interface org.eclipse.paho.client.mqttv3.MqttCallbackpublic void deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token)
deliveryComplete in interface org.eclipse.paho.client.mqttv3.MqttCallback