org.springframework.integration.mqtt.outbound
Class AbstractMqttMessageHandler
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.mqtt.outbound.AbstractMqttMessageHandler
- All Implemented Interfaces:
- org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.core.Ordered, org.springframework.integration.context.Orderable, org.springframework.integration.history.TrackableComponent, org.springframework.integration.support.context.NamedComponent, org.springframework.messaging.MessageHandler
- Direct Known Subclasses:
- MqttPahoMessageHandler
public abstract class AbstractMqttMessageHandler
- extends org.springframework.integration.handler.AbstractMessageHandler
- implements org.springframework.context.SmartLifecycle
Abstract class for MQTT outbound channel adapters.
- Since:
- 1.0
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport |
logger |
Fields inherited from interface org.springframework.core.Ordered |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler |
getOrder, handleMessage, setOrder, setShouldTrack |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, 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 |
getComponentName |
AbstractMqttMessageHandler
public AbstractMqttMessageHandler(java.lang.String url,
java.lang.String clientId)
setDefaultTopic
public void setDefaultTopic(java.lang.String defaultTopic)
setDefaultQos
public void setDefaultQos(int defaultQos)
setDefaultRetained
public void setDefaultRetained(boolean defaultRetain)
setConverter
public void setConverter(MqttMessageConverter converter)
getUrl
protected java.lang.String getUrl()
getClientId
protected java.lang.String getClientId()
onInit
protected void onInit()
throws java.lang.Exception
- Overrides:
onInit
in class org.springframework.integration.context.IntegrationObjectSupport
- Throws:
java.lang.Exception
start
public final void start()
- Specified by:
start
in interface org.springframework.context.Lifecycle
doStart
protected abstract void doStart()
stop
public final void stop()
- Specified by:
stop
in interface org.springframework.context.Lifecycle
doStop
protected abstract void doStop()
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interface org.springframework.context.Lifecycle
getPhase
public int getPhase()
- Specified by:
getPhase
in interface org.springframework.context.Phased
setPhase
public void setPhase(int phase)
setAutoStartup
public void setAutoStartup(boolean autoStartup)
isAutoStartup
public boolean isAutoStartup()
- Specified by:
isAutoStartup
in interface org.springframework.context.SmartLifecycle
stop
public void stop(java.lang.Runnable callback)
- Specified by:
stop
in interface org.springframework.context.SmartLifecycle
handleMessageInternal
protected void handleMessageInternal(org.springframework.messaging.Message<?> message)
throws java.lang.Exception
- Specified by:
handleMessageInternal
in class org.springframework.integration.handler.AbstractMessageHandler
- Throws:
java.lang.Exception
connectIfNeeded
protected abstract void connectIfNeeded()
publish
protected abstract void publish(java.lang.String topic,
java.lang.Object mqttMessage)
throws java.lang.Exception
- Throws:
java.lang.Exception
getComponentType
public java.lang.String getComponentType()
- Specified by:
getComponentType
in interface org.springframework.integration.support.context.NamedComponent
- Overrides:
getComponentType
in class org.springframework.integration.handler.AbstractMessageHandler