Class Mqttv5PahoMessageDrivenChannelAdapter
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.MessageProducerSupport
org.springframework.integration.mqtt.inbound.AbstractMqttMessageDrivenChannelAdapter<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
org.springframework.integration.mqtt.inbound.Mqttv5PahoMessageDrivenChannelAdapter
- All Implemented Interfaces:
org.eclipse.paho.mqttv5.client.MqttCallback,Aware,BeanFactoryAware,BeanNameAware,DisposableBean,InitializingBean,SmartInitializingSingleton,ApplicationContextAware,ApplicationEventPublisherAware,Lifecycle,Phased,SmartLifecycle,ComponentSourceAware,ExpressionCapable,MessageProducer,IntegrationPattern,ClientManager.ConnectCallback,MqttComponent<org.eclipse.paho.mqttv5.client.MqttConnectionOptions>,NamedComponent,IntegrationInboundManagement,IntegrationManagement,ManageableLifecycle,ManageableSmartLifecycle,TrackableComponent
@Deprecated(since="7.2",
forRemoval=true)
public class Mqttv5PahoMessageDrivenChannelAdapter
extends AbstractMqttMessageDrivenChannelAdapter<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>
Deprecated, for removal: This API element is subject to removal in a future version.
The
AbstractMqttMessageDrivenChannelAdapter implementation for MQTT v5.
The MqttProperties are mapped via the provided HeaderMapper;
meanwhile the regular MqttMessage properties are always mapped into headers.
It is recommended to have the MqttConnectionOptions.setAutomaticReconnect(boolean)
set to true to let an internal IMqttAsyncClient instance to handle reconnects.
Otherwise, only the manual restart of this component can handle reconnects, e.g. via
MqttConnectionFailedEvent handling on disconnection.
See setPayloadType(java.lang.Class<?>) for more information about type conversion.
- Since:
- 5.5.5
- Author:
- Artem Bilan, Mikhail Polivakha, Lucas Bowler, Artem Vozhdayenko, Matthias Thoma, Glenn Renfro, Goutam Adwant, Jaehong Park
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
Fields inherited from class org.springframework.integration.mqtt.inbound.AbstractMqttMessageDrivenChannelAdapter
topicLockFields inherited from class org.springframework.integration.endpoint.AbstractEndpoint
lifecycleLockFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionMqttv5PahoMessageDrivenChannelAdapter(String url, String clientId, String... topic) Deprecated, for removal: This API element is subject to removal in a future version.Mqttv5PahoMessageDrivenChannelAdapter(String url, String clientId, org.eclipse.paho.mqttv5.common.MqttSubscription... mqttSubscriptions) Deprecated, for removal: This API element is subject to removal in a future version.Create an instance based on the MQTT url, client id and subscriptions.Mqttv5PahoMessageDrivenChannelAdapter(org.eclipse.paho.mqttv5.client.MqttConnectionOptions connectionOptions, String clientId, String... topic) Deprecated, for removal: This API element is subject to removal in a future version.Mqttv5PahoMessageDrivenChannelAdapter(org.eclipse.paho.mqttv5.client.MqttConnectionOptions connectionOptions, String clientId, org.eclipse.paho.mqttv5.common.MqttSubscription... mqttSubscriptions) Deprecated, for removal: This API element is subject to removal in a future version.Create an instance based on the MQTT connection options, client id and subscriptions.Mqttv5PahoMessageDrivenChannelAdapter(ClientManager<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions> clientManager, String... topic) Deprecated, for removal: This API element is subject to removal in a future version.Use this constructor when you need to use a singleClientManager(for instance, to reuse an MQTT connection).Mqttv5PahoMessageDrivenChannelAdapter(ClientManager<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions> clientManager, org.eclipse.paho.mqttv5.common.MqttSubscription... mqttSubscriptions) Deprecated, for removal: This API element is subject to removal in a future version.Create an instance based on the client manager and subscriptions. -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated, for removal: This API element is subject to removal in a future version.Add a topic to the subscribed list.voidauthPacketArrived(int reasonCode, org.eclipse.paho.mqttv5.common.packet.MqttProperties properties) Deprecated, for removal: This API element is subject to removal in a future version.voidconnectComplete(boolean isReconnect) Deprecated, for removal: This API element is subject to removal in a future version.Called when the connection to the server is completed successfully.voidconnectComplete(boolean reconnect, @Nullable String serverURI) Deprecated, for removal: This API element is subject to removal in a future version.voiddeliveryComplete(org.eclipse.paho.mqttv5.client.IMqttToken token) Deprecated, for removal: This API element is subject to removal in a future version.voiddestroy()Deprecated, for removal: This API element is subject to removal in a future version.voiddisconnected(org.eclipse.paho.mqttv5.client.MqttDisconnectResponse disconnectResponse) Deprecated, for removal: This API element is subject to removal in a future version.protected voiddoStart()Deprecated, for removal: This API element is subject to removal in a future version.Take no action by default.protected voiddoStop()Deprecated, for removal: This API element is subject to removal in a future version.Take no action by default.org.eclipse.paho.mqttv5.client.MqttConnectionOptionsDeprecated, for removal: This API element is subject to removal in a future version.Return information about the connection.voidmessageArrived(String topic, org.eclipse.paho.mqttv5.common.MqttMessage mqttMessage) Deprecated, for removal: This API element is subject to removal in a future version.voidmqttErrorOccurred(org.eclipse.paho.mqttv5.common.MqttException exception) Deprecated, for removal: This API element is subject to removal in a future version.protected voidonInit()Deprecated, for removal: This API element is subject to removal in a future version.Subclasses may implement this for initialization logic.voidremoveTopic(String... topics) Deprecated, for removal: This API element is subject to removal in a future version.Remove a topic (or topics) from the subscribed list.voidsetConverter(MqttMessageConverter converter) Deprecated, for removal: This API element is subject to removal in a future version.voidsetHeaderMapper(HeaderMapper<org.eclipse.paho.mqttv5.common.packet.MqttProperties> headerMapper) Deprecated, for removal: This API element is subject to removal in a future version.voidsetMessageConverter(SmartMessageConverter messageConverter) Deprecated, for removal: This API element is subject to removal in a future version.voidsetPayloadType(Class<?> payloadType) Deprecated, for removal: This API element is subject to removal in a future version.Set the type of the target message payload to produce after conversion from MQTT message.voidsetPersistence(@Nullable org.eclipse.paho.mqttv5.client.MqttClientPersistence persistence) Deprecated, for removal: This API element is subject to removal in a future version.voidsetQos(int... qos) Deprecated, for removal: This API element is subject to removal in a future version.Set the QoS for each topic; a single value will apply to all topics otherwise the correct number of qos values must be provided.Methods inherited from class org.springframework.integration.mqtt.inbound.AbstractMqttMessageDrivenChannelAdapter
addTopic, addTopics, getApplicationEventPublisher, getClientId, getClientManager, getCompletionTimeout, getComponentType, getConverter, getDisconnectCompletionTimeout, getQos, getQuiescentTimeout, getTopic, getUrl, isManualAcks, setApplicationEventPublisher, setCompletionTimeout, setDisconnectCompletionTimeout, setManualAcks, setQuiescentTimeoutMethods inherited from class org.springframework.integration.endpoint.MessageProducerSupport
afterSingletonsInstantiated, buildErrorMessage, getErrorChannel, getErrorMessageAttributes, getErrorMessageStrategy, getIntegrationPatternType, getMessagingTemplate, getOutputChannel, getOutputChannelName, getRequiredOutputChannel, isObserved, registerObservationRegistry, sendErrorMessageIfNecessary, sendMessage, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setObservationConvention, setOutputChannel, setOutputChannelName, setSendTimeout, setShouldTrack, subscribeToPublisherMethods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopMethods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.BeanNameAware
setBeanNameMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getManagedName, getManagedType, getOverrides, getThisAs, isLoggingEnabled, registerMetricsCaptor, setLoggingEnabled, setManagedName, setManagedTypeMethods inherited from interface org.springframework.integration.mqtt.core.MqttComponent
getBeanNameMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentNameMethods inherited from interface org.springframework.context.SmartLifecycle
isPauseable
-
Constructor Details
-
Mqttv5PahoMessageDrivenChannelAdapter
public Mqttv5PahoMessageDrivenChannelAdapter(String url, String clientId, org.eclipse.paho.mqttv5.common.MqttSubscription... mqttSubscriptions) Deprecated, for removal: This API element is subject to removal in a future version.Create an instance based on the MQTT url, client id and subscriptions.- Parameters:
url- the MQTT url to connect.clientId- the unique client id.mqttSubscriptions- the MQTT subscriptions.- Since:
- 6.3
-
Mqttv5PahoMessageDrivenChannelAdapter
Deprecated, for removal: This API element is subject to removal in a future version. -
Mqttv5PahoMessageDrivenChannelAdapter
public Mqttv5PahoMessageDrivenChannelAdapter(org.eclipse.paho.mqttv5.client.MqttConnectionOptions connectionOptions, String clientId, org.eclipse.paho.mqttv5.common.MqttSubscription... mqttSubscriptions) Deprecated, for removal: This API element is subject to removal in a future version.Create an instance based on the MQTT connection options, client id and subscriptions.- Parameters:
connectionOptions- the MQTT connection options.clientId- the unique client id.mqttSubscriptions- the MQTT subscriptions.- Since:
- 6.3
-
Mqttv5PahoMessageDrivenChannelAdapter
public Mqttv5PahoMessageDrivenChannelAdapter(org.eclipse.paho.mqttv5.client.MqttConnectionOptions connectionOptions, String clientId, String... topic) Deprecated, for removal: This API element is subject to removal in a future version. -
Mqttv5PahoMessageDrivenChannelAdapter
public Mqttv5PahoMessageDrivenChannelAdapter(ClientManager<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions> clientManager, org.eclipse.paho.mqttv5.common.MqttSubscription... mqttSubscriptions) Deprecated, for removal: This API element is subject to removal in a future version.Create an instance based on the client manager and subscriptions.- Parameters:
clientManager- The client manager.mqttSubscriptions- the MQTT subscriptions.- Since:
- 6.3
-
Mqttv5PahoMessageDrivenChannelAdapter
public Mqttv5PahoMessageDrivenChannelAdapter(ClientManager<org.eclipse.paho.mqttv5.client.IMqttAsyncClient, org.eclipse.paho.mqttv5.client.MqttConnectionOptions> clientManager, String... topic) Deprecated, for removal: This API element is subject to removal in a future version.Use this constructor when you need to use a singleClientManager(for instance, to reuse an MQTT connection).- Parameters:
clientManager- The client manager.topic- The topic(s).- Since:
- 6.0
-
-
Method Details
-
getConnectionInfo
public org.eclipse.paho.mqttv5.client.MqttConnectionOptions getConnectionInfo()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MqttComponentReturn information about the connection.- Specified by:
getConnectionInfoin interfaceMqttComponent<org.eclipse.paho.mqttv5.client.MqttConnectionOptions>- Returns:
- the information.
-
setPersistence
public void setPersistence(@Nullable org.eclipse.paho.mqttv5.client.MqttClientPersistence persistence) Deprecated, for removal: This API element is subject to removal in a future version. -
setConverter
Deprecated, for removal: This API element is subject to removal in a future version.- Overrides:
setConverterin classAbstractMqttMessageDrivenChannelAdapter<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
-
setMessageConverter
Deprecated, for removal: This API element is subject to removal in a future version. -
setPayloadType
Deprecated, for removal: This API element is subject to removal in a future version.Set the type of the target message payload to produce after conversion from MQTT message. Defaults tobyte[].class- just extract MQTT message payload without conversion. Can be set toMqttMessageclass to produce the whole MQTT message as a payload.- Parameters:
payloadType- the expected payload type to convert MQTT message to.
-
setHeaderMapper
public void setHeaderMapper(HeaderMapper<org.eclipse.paho.mqttv5.common.packet.MqttProperties> headerMapper) Deprecated, for removal: This API element is subject to removal in a future version. -
onInit
protected void onInit()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
onInitin classAbstractMqttMessageDrivenChannelAdapter<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
-
doStart
protected void doStart()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:MessageProducerSupportTake no action by default. Subclasses may override this if they need lifecycle-managed behavior. Protected by 'lifecycleLock'.- Overrides:
doStartin classMessageProducerSupport
-
doStop
protected void doStop()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:MessageProducerSupportTake no action by default. Subclasses may override this if they need lifecycle-managed behavior.- Overrides:
doStopin classMessageProducerSupport
-
destroy
public void destroy()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
destroyin interfaceDisposableBean- Specified by:
destroyin interfaceIntegrationManagement- Overrides:
destroyin classAbstractMqttMessageDrivenChannelAdapter<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions>
-
setQos
public void setQos(int... qos) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractMqttMessageDrivenChannelAdapterSet the QoS for each topic; a single value will apply to all topics otherwise the correct number of qos values must be provided.- Overrides:
setQosin classAbstractMqttMessageDrivenChannelAdapter<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions> - Parameters:
qos- The qos value(s).
-
addTopic
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractMqttMessageDrivenChannelAdapterAdd a topic to the subscribed list.- Overrides:
addTopicin classAbstractMqttMessageDrivenChannelAdapter<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions> - Parameters:
topic- The topic.qos- The qos.
-
removeTopic
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractMqttMessageDrivenChannelAdapterRemove a topic (or topics) from the subscribed list.- Overrides:
removeTopicin classAbstractMqttMessageDrivenChannelAdapter<org.eclipse.paho.mqttv5.client.IMqttAsyncClient,org.eclipse.paho.mqttv5.client.MqttConnectionOptions> - Parameters:
topics- The topic.
-
messageArrived
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
messageArrivedin interfaceorg.eclipse.paho.mqttv5.client.MqttCallback
-
disconnected
public void disconnected(org.eclipse.paho.mqttv5.client.MqttDisconnectResponse disconnectResponse) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
disconnectedin interfaceorg.eclipse.paho.mqttv5.client.MqttCallback
-
mqttErrorOccurred
public void mqttErrorOccurred(org.eclipse.paho.mqttv5.common.MqttException exception) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
mqttErrorOccurredin interfaceorg.eclipse.paho.mqttv5.client.MqttCallback
-
deliveryComplete
public void deliveryComplete(org.eclipse.paho.mqttv5.client.IMqttToken token) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
deliveryCompletein interfaceorg.eclipse.paho.mqttv5.client.MqttCallback
-
connectComplete
public void connectComplete(boolean isReconnect) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ClientManager.ConnectCallbackCalled when the connection to the server is completed successfully.- Specified by:
connectCompletein interfaceClientManager.ConnectCallback- Parameters:
isReconnect- if true, the connection was the result of automatic reconnecting.
-
connectComplete
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
connectCompletein interfaceorg.eclipse.paho.mqttv5.client.MqttCallback
-
authPacketArrived
public void authPacketArrived(int reasonCode, org.eclipse.paho.mqttv5.common.packet.MqttProperties properties) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
authPacketArrivedin interfaceorg.eclipse.paho.mqttv5.client.MqttCallback
-
spring-integration-mqtt-clientmodule.