Class AbstractMqttMessageDrivenChannelAdapter
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.MessageProducerSupport
org.springframework.integration.mqtt.inbound.AbstractMqttMessageDrivenChannelAdapter
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,SmartInitializingSingleton
,ApplicationContextAware
,Lifecycle
,Phased
,SmartLifecycle
,ExpressionCapable
,MessageProducer
,IntegrationPattern
,NamedComponent
,ManageableLifecycle
,ManageableSmartLifecycle
,TrackableComponent
- Direct Known Subclasses:
MqttPahoMessageDrivenChannelAdapter
@ManagedResource @IntegrationManagedResource public abstract class AbstractMqttMessageDrivenChannelAdapter extends MessageProducerSupport
Abstract class for MQTT Message-Driven Channel Adapters.
- Since:
- 4.0
- Author:
- Gary Russell, Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.integration.endpoint.AbstractEndpoint
lifecycleCondition, lifecycleLock
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Constructor Summary
Constructors Constructor Description AbstractMqttMessageDrivenChannelAdapter(String url, String clientId, String... topic)
-
Method Summary
Modifier and Type Method Description void
addTopic(String... topic)
Add a topic (or topics) to the subscribed list (qos=1).void
addTopic(String topic, int qos)
Add a topic to the subscribed list.void
addTopics(String[] topic, int[] qos)
Add topics to the subscribed list.protected String
getClientId()
String
getComponentType()
Subclasses may implement this method to provide component type information.protected MqttMessageConverter
getConverter()
int[]
getQos()
String[]
getTopic()
protected String
getUrl()
protected void
onInit()
Subclasses may implement this for initialization logic.void
removeTopic(String... topic)
Remove a topic (or topics) from the subscribed list.void
setConverter(MqttMessageConverter converter)
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.Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupport
afterSingletonsInstantiated, buildErrorMessage, doStart, doStop, getErrorChannel, getErrorMessageAttributes, getIntegrationPatternType, getMessagingTemplate, getOutputChannel, sendErrorMessageIfNecessary, sendMessage, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setOutputChannel, setOutputChannelName, setSendTimeout, setShouldTrack, subscribeToPublisher
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
destroy, doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stop
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, 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, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Field Details
-
Constructor Details
-
Method Details
-
setConverter
-
setQos
public 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
-
getComponentType
Description copied from class:IntegrationObjectSupport
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
- Overrides:
getComponentType
in classIntegrationObjectSupport
-
addTopic
Add 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
-
addTopic
Add a topic (or topics) to the subscribed list (qos=1).- Parameters:
topic
- The topics.- Throws:
MessagingException
- if the topic is already in the list.- Since:
- 4.1
-
addTopics
Add topics to the subscribed list.- Parameters:
topic
- The topics.qos
- The qos for each topic.- Throws:
MessagingException
- if a topic is already in the list.- Since:
- 4.1
-
removeTopic
Remove 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
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classMessageProducerSupport
-