public abstract class AbstractMqttMessageHandler extends AbstractMessageHandler implements ManageableLifecycle
IntegrationManagement.ManagementOverrides
EXPRESSION_PARSER, logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
AbstractMqttMessageHandler(String url,
String clientId) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
doStart() |
protected abstract void |
doStop() |
String |
getClientId() |
int |
getClientInstance()
Incremented each time the client is connected.
|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected MessageConverter |
getConverter() |
protected String |
getUrl() |
protected void |
handleMessageInternal(Message<?> message) |
protected void |
incrementClientInstance() |
boolean |
isRunning() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected abstract void |
publish(String topic,
Object mqttMessage,
Message<?> message) |
void |
setConverter(MessageConverter converter)
Set the message converter to use; if this is provided, the adapter qos and retained
settings are ignored.
|
void |
setDefaultQos(int defaultQos)
Set the qos for messages if the
qosExpression
evaluates to null. |
void |
setDefaultRetained(boolean defaultRetained)
Set the retained boolean for messages if the
retainedExpression evaluates to null. |
void |
setDefaultTopic(String defaultTopic)
Set the topic to which the message will be published if the
topicExpression evaluates to `null`. |
void |
setQosExpression(Expression qosExpression)
Set the qos expression; default "headers['mqtt_qos']".
|
void |
setQosExpressionString(String qosExpression)
Set the qos expression; default "headers['mqtt_qos']".
|
void |
setRetainedExpression(Expression retainedExpression)
Set the retained expression; default "headers['mqtt_retained']".
|
void |
setRetainedExpressionString(String retainedExpression)
Set the retained expression; default "headers['mqtt_retained']".
|
void |
setTopicExpression(Expression topicExpression)
Set the topic expression; default "headers['mqtt_topic']".
|
void |
setTopicExpressionString(String topicExpression)
Set the topic expression; default "headers['mqtt_topic']".
|
void |
start() |
void |
stop() |
handleMessage, onComplete, onError, onNext, onSubscribe
buildSendTimer, destroy, getIntegrationPatternType, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getThisAs
getBeanName, getComponentName
public void setDefaultTopic(String defaultTopic)
topicExpression
evaluates to `null`.defaultTopic
- the default topic.public void setTopicExpression(Expression topicExpression)
topicExpression
- the expression.public void setTopicExpressionString(String topicExpression)
topicExpression
- the expression.public void setDefaultQos(int defaultQos)
qosExpression
evaluates to null. Only applies if a message converter is not provided.defaultQos
- the default qos.setConverter(MessageConverter)
public void setQosExpression(Expression qosExpression)
qosExpression
- the expression.setConverter(MessageConverter)
public void setQosExpressionString(String qosExpression)
qosExpression
- the expression.setConverter(MessageConverter)
public void setDefaultRetained(boolean defaultRetained)
retainedExpression
evaluates to null.
Only applies if a message converter is not provided.defaultRetained
- the default defaultRetained.setConverter(MessageConverter)
public void setRetainedExpression(Expression retainedExpression)
retainedExpression
- the expression.setConverter(MessageConverter)
public void setRetainedExpressionString(String retainedExpression)
retainedExpression
- the expression.setConverter(MessageConverter)
public void setConverter(MessageConverter converter)
converter
- the converter.protected MessageConverter getConverter()
public String getClientId()
public int getClientInstance()
public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class MessageHandlerSupport
protected void incrementClientInstance()
protected void onInit()
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
public final void start()
start
in interface Lifecycle
start
in interface ManageableLifecycle
protected abstract void doStart()
public final void stop()
stop
in interface Lifecycle
stop
in interface ManageableLifecycle
protected abstract void doStop()
public boolean isRunning()
isRunning
in interface Lifecycle
isRunning
in interface ManageableLifecycle
protected void handleMessageInternal(Message<?> message)
handleMessageInternal
in class AbstractMessageHandler