Class AbstractMqttMessageHandler<T,C>
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.mqtt.outbound.AbstractMqttMessageHandler<T,C>
- Type Parameters:
T- MQTT Client typeC- MQTT connection options type (v5 or v3)
- All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>,Aware,BeanFactoryAware,BeanNameAware,DisposableBean,InitializingBean,ApplicationContextAware,ApplicationEventPublisherAware,Lifecycle,Ordered,ComponentSourceAware,ExpressionCapable,Orderable,IntegrationPattern,NamedComponent,IntegrationManagement,ManageableLifecycle,TrackableComponent,MessageHandler,reactor.core.CoreSubscriber<Message<?>>
- Direct Known Subclasses:
MqttPahoMessageHandler,Mqttv5PahoMessageHandler
@Deprecated(since="7.2",
forRemoval=true)
public abstract class AbstractMqttMessageHandler<T,C>
extends AbstractMessageHandler
implements ManageableLifecycle, ApplicationEventPublisherAware
Deprecated, for removal: This API element is subject to removal in a future version.
Abstract class for MQTT outbound channel adapters.
- Since:
- 4.0
- Author:
- Gary Russell, Artem Bilan, Artem Vozhdayenko, Jaehong Park
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longDeprecated, for removal: This API element is subject to removal in a future version.The default completion timeout in milliseconds.static final longDeprecated, for removal: This API element is subject to removal in a future version.The default disconnect completion timeout in milliseconds.protected final LockDeprecated, for removal: This API element is subject to removal in a future version.Fields 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.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionAbstractMqttMessageHandler(@Nullable String url, String clientId) Deprecated, for removal: This API element is subject to removal in a future version.AbstractMqttMessageHandler(ClientManager<T, C> clientManager) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voiddoStart()Deprecated, for removal: This API element is subject to removal in a future version.protected abstract voiddoStop()Deprecated, for removal: This API element is subject to removal in a future version.protected ApplicationEventPublisherDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.intDeprecated, for removal: This API element is subject to removal in a future version.Incremented each time the client is connected.protected @Nullable ClientManager<T,C> Deprecated, for removal: This API element is subject to removal in a future version.protected longDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.protected MessageConverterDeprecated, for removal: This API element is subject to removal in a future version.protected intDeprecated, for removal: This API element is subject to removal in a future version.protected booleanDeprecated, for removal: This API element is subject to removal in a future version.protected @Nullable StringDeprecated, for removal: This API element is subject to removal in a future version.protected longDeprecated, for removal: This API element is subject to removal in a future version.protected MessageProcessor<Integer>Deprecated, for removal: This API element is subject to removal in a future version.protected MessageProcessor<Boolean>Deprecated, for removal: This API element is subject to removal in a future version.protected MessageProcessor<String>Deprecated, for removal: This API element is subject to removal in a future version.protected @Nullable StringgetUrl()Deprecated, for removal: This API element is subject to removal in a future version.protected voidhandleMessageInternal(Message<?> message) Deprecated, for removal: This API element is subject to removal in a future version.protected voidDeprecated, for removal: This API element is subject to removal in a future version.protected booleanisAsync()Deprecated, for removal: This API element is subject to removal in a future version.booleanDeprecated, for removal: This API element is subject to removal in a future version.protected voidmessageSentEvent(Message<?> message, String topic, int messageId) 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.protected abstract voidDeprecated, for removal: This API element is subject to removal in a future version.protected voidsendDeliveryCompleteEvent(int messageId) Deprecated, for removal: This API element is subject to removal in a future version.protected voidsendFailedDeliveryEvent(int messageId, Throwable exception) Deprecated, for removal: This API element is subject to removal in a future version.voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) Deprecated, for removal: This API element is subject to removal in a future version.voidsetAsync(boolean async) Deprecated, for removal: This API element is subject to removal in a future version.Set to true if you don't want to block when sending messages.voidsetAsyncEvents(boolean asyncEvents) Deprecated, for removal: This API element is subject to removal in a future version.WhensetAsync(boolean)is true, setting this to true enables publication ofMqttMessageSentEventandMqttMessageDeliveredEventto be emitted.voidsetCompletionTimeout(long completionTimeout) Deprecated, for removal: This API element is subject to removal in a future version.Set the completion timeout for async operations.voidsetConverter(MessageConverter converter) Deprecated, for removal: This API element is subject to removal in a future version.Set the message converter to use; if this is provided, the adapter qos and retained settings are ignored.voidsetDefaultQos(int defaultQos) Deprecated, for removal: This API element is subject to removal in a future version.Set the qos for messages if theqosExpressionevaluates to null.voidsetDefaultRetained(boolean defaultRetained) Deprecated, for removal: This API element is subject to removal in a future version.Set the retained boolean for messages if theretainedExpressionevaluates to null.voidsetDefaultTopic(String defaultTopic) Deprecated, for removal: This API element is subject to removal in a future version.Set the topic to which the message will be published if thetopicExpressionevaluates to `null`.voidsetDisconnectCompletionTimeout(long completionTimeout) Deprecated, for removal: This API element is subject to removal in a future version.Set the completion timeout when disconnecting.voidsetQosExpression(Expression qosExpression) Deprecated, for removal: This API element is subject to removal in a future version.Set the qos expression; default "headers['mqtt_qos']".voidsetQosExpressionString(String qosExpression) Deprecated, for removal: This API element is subject to removal in a future version.Set the qos expression; default "headers['mqtt_qos']".voidsetRetainedExpression(Expression retainedExpression) Deprecated, for removal: This API element is subject to removal in a future version.Set the retained expression; default "headers['mqtt_retained']".voidsetRetainedExpressionString(String retainedExpression) Deprecated, for removal: This API element is subject to removal in a future version.Set the retained expression; default "headers['mqtt_retained']".voidsetTopicExpression(Expression topicExpression) Deprecated, for removal: This API element is subject to removal in a future version.Set the topic expression; default "headers['mqtt_topic']".voidsetTopicExpressionString(String topicExpression) Deprecated, for removal: This API element is subject to removal in a future version.Set the topic expression; default "headers['mqtt_topic']".final voidstart()Deprecated, for removal: This API element is subject to removal in a future version.final voidstop()Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribe, setObservationConventionMethods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, 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.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 reactor.core.CoreSubscriber
currentContextMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Field Details
-
DISCONNECT_COMPLETION_TIMEOUT
public static final long DISCONNECT_COMPLETION_TIMEOUTDeprecated, for removal: This API element is subject to removal in a future version.The default disconnect completion timeout in milliseconds.- See Also:
-
DEFAULT_COMPLETION_TIMEOUT
public static final long DEFAULT_COMPLETION_TIMEOUTDeprecated, for removal: This API element is subject to removal in a future version.The default completion timeout in milliseconds.- See Also:
-
lock
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
AbstractMqttMessageHandler
Deprecated, for removal: This API element is subject to removal in a future version. -
AbstractMqttMessageHandler
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
setApplicationEventPublisher
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
setApplicationEventPublisherin interfaceApplicationEventPublisherAware
-
getApplicationEventPublisher
Deprecated, for removal: This API element is subject to removal in a future version. -
setDefaultTopic
Deprecated, for removal: This API element is subject to removal in a future version.Set the topic to which the message will be published if thetopicExpressionevaluates to `null`.- Parameters:
defaultTopic- the default topic.
-
getDefaultTopic
Deprecated, for removal: This API element is subject to removal in a future version. -
setTopicExpression
Deprecated, for removal: This API element is subject to removal in a future version.Set the topic expression; default "headers['mqtt_topic']".- Parameters:
topicExpression- the expression.- Since:
- 5.0
-
setTopicExpressionString
Deprecated, for removal: This API element is subject to removal in a future version.Set the topic expression; default "headers['mqtt_topic']".- Parameters:
topicExpression- the expression.- Since:
- 5.0
-
getTopicProcessor
Deprecated, for removal: This API element is subject to removal in a future version. -
setDefaultQos
public void setDefaultQos(int defaultQos) Deprecated, for removal: This API element is subject to removal in a future version.Set the qos for messages if theqosExpressionevaluates to null. Only applies if a message converter is not provided.- Parameters:
defaultQos- the default qos.- See Also:
-
getDefaultQos
protected int getDefaultQos()Deprecated, for removal: This API element is subject to removal in a future version. -
setQosExpression
Deprecated, for removal: This API element is subject to removal in a future version.Set the qos expression; default "headers['mqtt_qos']". Only applies if a message converter is not provided.- Parameters:
qosExpression- the expression.- Since:
- 5.0
- See Also:
-
setQosExpressionString
Deprecated, for removal: This API element is subject to removal in a future version.Set the qos expression; default "headers['mqtt_qos']". Only applies if a message converter is not provided.- Parameters:
qosExpression- the expression.- Since:
- 5.0
- See Also:
-
getQosProcessor
Deprecated, for removal: This API element is subject to removal in a future version. -
setDefaultRetained
public void setDefaultRetained(boolean defaultRetained) Deprecated, for removal: This API element is subject to removal in a future version.Set the retained boolean for messages if theretainedExpressionevaluates to null. Only applies if a message converter is not provided.- Parameters:
defaultRetained- the default defaultRetained.- See Also:
-
getDefaultRetained
protected boolean getDefaultRetained()Deprecated, for removal: This API element is subject to removal in a future version. -
setRetainedExpression
Deprecated, for removal: This API element is subject to removal in a future version.Set the retained expression; default "headers['mqtt_retained']". Only applies if a message converter is not provided.- Parameters:
retainedExpression- the expression.- Since:
- 5.0
- See Also:
-
setRetainedExpressionString
Deprecated, for removal: This API element is subject to removal in a future version.Set the retained expression; default "headers['mqtt_retained']". Only applies if a message converter is not provided.- Parameters:
retainedExpression- the expression.- Since:
- 5.0
- See Also:
-
getRetainedProcessor
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.Set the message converter to use; if this is provided, the adapter qos and retained settings are ignored.- Parameters:
converter- the converter.
-
getConverter
Deprecated, for removal: This API element is subject to removal in a future version. -
getUrl
Deprecated, for removal: This API element is subject to removal in a future version. -
getClientId
Deprecated, for removal: This API element is subject to removal in a future version. -
getClientInstance
public int getClientInstance()Deprecated, for removal: This API element is subject to removal in a future version.Incremented each time the client is connected.- Returns:
- The instance;
- Since:
- 4.1
-
getComponentType
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getComponentTypein interfaceNamedComponent- Overrides:
getComponentTypein classMessageHandlerSupport
-
incrementClientInstance
protected void incrementClientInstance()Deprecated, for removal: This API element is subject to removal in a future version. -
setCompletionTimeout
public void setCompletionTimeout(long completionTimeout) Deprecated, for removal: This API element is subject to removal in a future version.Set the completion timeout for async operations. Not settable using the namespace. Default 30000L milliseconds.- Parameters:
completionTimeout- The timeout.- Since:
- 4.1
-
getCompletionTimeout
protected long getCompletionTimeout()Deprecated, for removal: This API element is subject to removal in a future version. -
setDisconnectCompletionTimeout
public void setDisconnectCompletionTimeout(long completionTimeout) Deprecated, for removal: This API element is subject to removal in a future version.Set the completion timeout when disconnecting. Not settable using the namespace. Default 5000L milliseconds.- Parameters:
completionTimeout- The timeout.- Since:
- 5.1.10
-
getDisconnectCompletionTimeout
protected long getDisconnectCompletionTimeout()Deprecated, for removal: This API element is subject to removal in a future version. -
getClientManager
Deprecated, for removal: This API element is subject to removal in a future version. -
setAsync
public void setAsync(boolean async) Deprecated, for removal: This API element is subject to removal in a future version.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:
-
isAsync
protected boolean isAsync()Deprecated, for removal: This API element is subject to removal in a future version. -
setAsyncEvents
public void setAsyncEvents(boolean asyncEvents) Deprecated, for removal: This API element is subject to removal in a future version.WhensetAsync(boolean)is true, setting this to true enables publication ofMqttMessageSentEventandMqttMessageDeliveredEventto be emitted. Default false.- Parameters:
asyncEvents- the asyncEvents.
-
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 classIntegrationObjectSupport
-
start
public final void start()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
startin interfaceLifecycle- Specified by:
startin interfaceManageableLifecycle
-
doStart
protected abstract void doStart()Deprecated, for removal: This API element is subject to removal in a future version. -
stop
public final void stop()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
stopin interfaceLifecycle- Specified by:
stopin interfaceManageableLifecycle
-
doStop
protected abstract void doStop()Deprecated, for removal: This API element is subject to removal in a future version. -
isRunning
public boolean isRunning()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
isRunningin interfaceLifecycle- Specified by:
isRunningin interfaceManageableLifecycle
-
handleMessageInternal
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
handleMessageInternalin classAbstractMessageHandler
-
messageSentEvent
Deprecated, for removal: This API element is subject to removal in a future version. -
sendDeliveryCompleteEvent
protected void sendDeliveryCompleteEvent(int messageId) Deprecated, for removal: This API element is subject to removal in a future version. -
sendFailedDeliveryEvent
Deprecated, for removal: This API element is subject to removal in a future version. -
publish
Deprecated, for removal: This API element is subject to removal in a future version.
-
spring-integration-mqtt-clientmodule.