Class Mqttv5PahoMessageHandler
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.mqtt.outbound.AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
org.springframework.integration.mqtt.outbound.Mqttv5PahoMessageHandler
- All Implemented Interfaces:
- org.eclipse.paho.mqttv5.client.MqttCallback,- org.reactivestreams.Subscriber<Message<?>>,- Aware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- ApplicationEventPublisherAware,- Lifecycle,- Ordered,- ExpressionCapable,- Orderable,- IntegrationPattern,- MqttComponent<org.eclipse.paho.mqttv5.client.MqttConnectionOptions>,- NamedComponent,- IntegrationManagement,- ManageableLifecycle,- TrackableComponent,- MessageHandler,- reactor.core.CoreSubscriber<Message<?>>
public class Mqttv5PahoMessageHandler
extends AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
implements org.eclipse.paho.mqttv5.client.MqttCallback, MqttComponent<org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
The 
AbstractMqttMessageHandler implementation for MQTT v5.- Since:
- 5.5.5
- Author:
- Artem Bilan, Lucas Bowler, Artem Vozhdayenko
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.mqtt.outbound.AbstractMqttMessageHandlerDEFAULT_COMPLETION_TIMEOUT, DISCONNECT_COMPLETION_TIMEOUT, lockFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructorsConstructorDescriptionMqttv5PahoMessageHandler(String url, String clientId) Mqttv5PahoMessageHandler(org.eclipse.paho.mqttv5.client.MqttConnectionOptions connectionOptions, String clientId) Mqttv5PahoMessageHandler(ClientManager<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions> clientManager) Use this constructor when you need to use a singleClientManager(for instance, to reuse an MQTT connection).
- 
Method SummaryModifier and TypeMethodDescriptionvoidauthPacketArrived(int reasonCode, org.eclipse.paho.mqttv5.common.packet.MqttProperties properties) voidconnectComplete(boolean reconnect, String serverURI) voiddeliveryComplete(org.eclipse.paho.mqttv5.client.IMqttToken token) voiddestroy()voiddisconnected(org.eclipse.paho.mqttv5.client.MqttDisconnectResponse disconnectResponse) protected voiddoStart()protected voiddoStop()org.eclipse.paho.mqttv5.client.MqttConnectionOptionsReturn information about the connection.protected voidhandleMessageInternal(Message<?> message) voidmessageArrived(String topic, org.eclipse.paho.mqttv5.common.MqttMessage message) voidmqttErrorOccurred(org.eclipse.paho.mqttv5.common.MqttException exception) protected voidonInit()Subclasses may implement this for initialization logic.protected voidvoidsetAsync(boolean async) Set to true if you don't want to block when sending messages.voidsetAsyncEvents(boolean asyncEvents) WhensetAsync(boolean)is true, setting this to true enables publication ofMqttMessageSentEventandMqttMessageDeliveredEventto be emitted.voidsetHeaderMapper(HeaderMapper<org.eclipse.paho.mqttv5.common.packet.MqttProperties> headerMapper) voidsetPersistence(org.eclipse.paho.mqttv5.client.MqttClientPersistence persistence) Methods inherited from class org.springframework.integration.mqtt.outbound.AbstractMqttMessageHandlergetApplicationEventPublisher, getClientId, getClientInstance, getClientManager, getCompletionTimeout, getComponentType, getConverter, getDefaultQos, getDefaultRetained, getDefaultTopic, getDisconnectCompletionTimeout, getQosProcessor, getRetainedProcessor, getTopicProcessor, getUrl, incrementClientInstance, isRunning, setApplicationEventPublisher, setCompletionTimeout, setConverter, setDefaultQos, setDefaultRetained, setDefaultTopic, setDisconnectCompletionTimeout, setQosExpression, setQosExpressionString, setRetainedExpression, setRetainedExpressionString, setTopicExpression, setTopicExpressionString, start, stopMethods inherited from class org.springframework.integration.handler.AbstractMessageHandlerhandleMessage, onComplete, onError, onNext, onSubscribe, setObservationConventionMethods inherited from class org.springframework.integration.handler.MessageHandlerSupportbuildSendTimer, getIntegrationPatternType, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.BeanNameAwaresetBeanNameMethods inherited from interface reactor.core.CoreSubscribercurrentContextMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetThisAsMethods inherited from interface org.springframework.integration.mqtt.core.MqttComponentgetBeanNameMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
Mqttv5PahoMessageHandler
- 
Mqttv5PahoMessageHandlerpublic Mqttv5PahoMessageHandler(org.eclipse.paho.mqttv5.client.MqttConnectionOptions connectionOptions, String clientId) 
- 
Mqttv5PahoMessageHandlerpublic Mqttv5PahoMessageHandler(ClientManager<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions> clientManager) Use this constructor when you need to use a singleClientManager(for instance, to reuse an MQTT connection).- Parameters:
- clientManager- The client manager.
- Since:
- 6.0
 
 
- 
- 
Method Details- 
getConnectionInfopublic org.eclipse.paho.mqttv5.client.MqttConnectionOptions getConnectionInfo()Description copied from interface:MqttComponentReturn information about the connection.- Specified by:
- getConnectionInfoin interface- MqttComponent<org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
- Returns:
- the information.
 
- 
setPersistencepublic void setPersistence(@Nullable org.eclipse.paho.mqttv5.client.MqttClientPersistence persistence) 
- 
setHeaderMapperpublic void setHeaderMapper(HeaderMapper<org.eclipse.paho.mqttv5.common.packet.MqttProperties> headerMapper) 
- 
setAsyncpublic void setAsync(boolean async) Set to true if you don't want to block when sending messages. Default false. When true, message sent/delivered events will be published for reception by a suitably configured 'ApplicationListener' or an event inbound-channel-adapter.- Parameters:
- async- true for async.
- See Also:
 
- 
setAsyncEventspublic void setAsyncEvents(boolean asyncEvents) WhensetAsync(boolean)is true, setting this to true enables publication ofMqttMessageSentEventandMqttMessageDeliveredEventto be emitted. Default false.- Parameters:
- asyncEvents- the asyncEvents.
 
- 
onInitprotected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
- onInitin class- AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
 
- 
doStartprotected void doStart()- Specified by:
- doStartin class- AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
 
- 
doStopprotected void doStop()- Specified by:
- doStopin class- AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
 
- 
destroypublic void destroy()- Specified by:
- destroyin interface- DisposableBean
- Specified by:
- destroyin interface- IntegrationManagement
- Overrides:
- destroyin class- MessageHandlerSupport
 
- 
handleMessageInternal- Overrides:
- handleMessageInternalin class- AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
 
- 
publish- Specified by:
- publishin class- AbstractMqttMessageHandler<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
 
- 
deliveryCompletepublic void deliveryComplete(org.eclipse.paho.mqttv5.client.IMqttToken token) - Specified by:
- deliveryCompletein interface- org.eclipse.paho.mqttv5.client.MqttCallback
 
- 
disconnectedpublic void disconnected(org.eclipse.paho.mqttv5.client.MqttDisconnectResponse disconnectResponse) - Specified by:
- disconnectedin interface- org.eclipse.paho.mqttv5.client.MqttCallback
 
- 
mqttErrorOccurredpublic void mqttErrorOccurred(org.eclipse.paho.mqttv5.common.MqttException exception) - Specified by:
- mqttErrorOccurredin interface- org.eclipse.paho.mqttv5.client.MqttCallback
 
- 
messageArrived- Specified by:
- messageArrivedin interface- org.eclipse.paho.mqttv5.client.MqttCallback
 
- 
connectComplete- Specified by:
- connectCompletein interface- org.eclipse.paho.mqttv5.client.MqttCallback
 
- 
authPacketArrivedpublic void authPacketArrived(int reasonCode, org.eclipse.paho.mqttv5.common.packet.MqttProperties properties) - Specified by:
- authPacketArrivedin interface- org.eclipse.paho.mqttv5.client.MqttCallback
 
 
-