Class AbstractMqttMessageDrivenChannelAdapter<T,C> 
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.MessageProducerSupport
org.springframework.integration.mqtt.inbound.AbstractMqttMessageDrivenChannelAdapter<T,C> 
- Type Parameters:
- T- MQTT Client type
- C- MQTT connection options type (v5 or v3)
- All Implemented Interfaces:
- Aware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- SmartInitializingSingleton,- ApplicationContextAware,- ApplicationEventPublisherAware,- Lifecycle,- Phased,- SmartLifecycle,- ComponentSourceAware,- ExpressionCapable,- MessageProducer,- IntegrationPattern,- ClientManager.ConnectCallback,- NamedComponent,- IntegrationInboundManagement,- IntegrationManagement,- ManageableLifecycle,- ManageableSmartLifecycle,- TrackableComponent
- Direct Known Subclasses:
- MqttPahoMessageDrivenChannelAdapter,- Mqttv5PahoMessageDrivenChannelAdapter
@ManagedResource
@IntegrationManagedResource
public abstract class AbstractMqttMessageDrivenChannelAdapter<T,C> 
extends MessageProducerSupport
implements ApplicationEventPublisherAware, ClientManager.ConnectCallback
Abstract class for MQTT Message-Driven Channel Adapters.
- Since:
- 4.0
- Author:
- Gary Russell, Artem Bilan, Trung Pham, Mikhail Polivakha, Artem Vozhdayenko, Jiri Soucek, Glenn Renfro
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFieldsFields inherited from class org.springframework.integration.endpoint.AbstractEndpointlifecycleLockFields 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.context.SmartLifecycleDEFAULT_PHASE
- 
Constructor SummaryConstructorsConstructorDescriptionAbstractMqttMessageDrivenChannelAdapter(@Nullable String url, String clientId, String... topic) AbstractMqttMessageDrivenChannelAdapter(ClientManager<T, C> clientManager, String... topic) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd a topic (or topics) to the subscribed list (qos=1).voidAdd a topic to the subscribed list.voidAdd topics to the subscribed list.voiddestroy()protected ApplicationEventPublisherprotected Stringprotected @Nullable ClientManager<T, C> protected longprotected @Nullable MqttMessageConverterprotected longint[]getQos()protected longString[]getTopic()protected @Nullable StringgetUrl()protected booleanprotected voidonInit()Subclasses may implement this for initialization logic.voidremoveTopic(String... topic) Remove a topic (or topics) from the subscribed list.voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) voidsetCompletionTimeout(long completionTimeout) Set the completion timeout for operations.voidsetConverter(MqttMessageConverter converter) voidsetDisconnectCompletionTimeout(long completionTimeout) Set the completion timeout when disconnecting.voidsetManualAcks(boolean manualAcks) Set the acknowledgment mode to manual.voidsetQos(int... qos) Set the QoS for each topic; a single value will apply to all topics otherwise the correct number of qos values must be provided.voidsetQuiescentTimeout(long quiescentTimeout) Set the quiescentTimeout timeout when disconnecting.Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupportafterSingletonsInstantiated, buildErrorMessage, doStart, doStop, getErrorChannel, getErrorMessageAttributes, getErrorMessageStrategy, getIntegrationPatternType, getMessagingTemplate, getOutputChannel, getRequiredOutputChannel, isObserved, registerObservationRegistry, sendErrorMessageIfNecessary, sendMessage, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setObservationConvention, setOutputChannel, setOutputChannelName, setSendTimeout, setShouldTrack, subscribeToPublisherMethods inherited from class org.springframework.integration.endpoint.AbstractEndpointdoStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, 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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.mqtt.core.ClientManager.ConnectCallbackconnectCompleteMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetManagedName, getManagedType, getOverrides, getThisAs, isLoggingEnabled, registerMetricsCaptor, setLoggingEnabled, setManagedName, setManagedTypeMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentNameMethods inherited from interface org.springframework.context.SmartLifecycleisPauseable
- 
Field Details- 
topicLock
 
- 
- 
Constructor Details- 
AbstractMqttMessageDrivenChannelAdapter
- 
AbstractMqttMessageDrivenChannelAdapter
 
- 
- 
Method Details- 
setConverter
- 
getClientManager
- 
setQospublic void setQos(int... qos) Set the QoS for each topic; a single value will apply to all topics otherwise the correct number of qos values must be provided.- Parameters:
- qos- The qos value(s).
- Since:
- 4.1
 
- 
getQos
- 
getUrl
- 
getClientId
- 
getConverter
- 
getTopic
- 
setDisconnectCompletionTimeout
- 
getDisconnectCompletionTimeoutprotected long getDisconnectCompletionTimeout()
- 
setQuiescentTimeoutpublic void setQuiescentTimeout(long quiescentTimeout) Set the quiescentTimeout timeout when disconnecting. Default isClientManager.QUIESCENT_TIMEOUTmilliseconds.- Parameters:
- quiescentTimeout- The timeout.
- Since:
- 7.0.0
 
- 
getQuiescentTimeoutprotected long getQuiescentTimeout()
- 
onInitprotected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
- onInitin class- MessageProducerSupport
 
- 
destroypublic void destroy()- Specified by:
- destroyin interface- DisposableBean
- Specified by:
- destroyin interface- IntegrationManagement
- Overrides:
- destroyin class- AbstractEndpoint
 
- 
getComponentType- Specified by:
- getComponentTypein interface- NamedComponent
- Overrides:
- getComponentTypein class- MessageProducerSupport
 
- 
setApplicationEventPublisher- Specified by:
- setApplicationEventPublisherin interface- ApplicationEventPublisherAware
 
- 
getApplicationEventPublisher
- 
setManualAckspublic void setManualAcks(boolean manualAcks) Set the acknowledgment mode to manual.- Parameters:
- manualAcks- true for manual acks.
- Since:
- 5.3
 
- 
isManualAcksprotected boolean isManualAcks()
- 
setCompletionTimeout
- 
getCompletionTimeoutprotected long getCompletionTimeout()
- 
addTopicAdd a topic to the subscribed list.- Parameters:
- topic- The topic.
- qos- The qos.
- Throws:
- MessagingException- if the topic is already in the list.
- Since:
- 4.1
 
- 
addTopicAdd a topic (or topics) to the subscribed list (qos=1).- Parameters:
- topics- The topics.
- Throws:
- MessagingException- if the topics is already in the list.
- Since:
- 4.1
 
- 
addTopicsAdd topics to the subscribed list.- Parameters:
- topics- The topics.
- qos- The qos for each topic.
- Throws:
- MessagingException- if a topics is already in the list.
- Since:
- 4.1
 
- 
removeTopicRemove a topic (or topics) from the subscribed list.- Parameters:
- topic- The topic.
- Throws:
- MessagingException- if the topic is not in the list.
- Since:
- 4.1
 
 
-