Package org.chenile.configuration.mqtt
Class MqttConfiguration
java.lang.Object
org.chenile.configuration.mqtt.MqttConfiguration
Sets up Eclipse Paho for communicating with MQ-TT broker using configurations
-
Field Summary
Modifier and TypeFieldDescriptionprivate int
(package private) String
This is the base publish topic that will be pre-pended to publish messages.private String
This is the base topic name that will pre-pended for all subscriptions.private String
private String
(package private) org.slf4j.Logger
private boolean
private Long
private String
private int
private boolean
private String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThis converts a string to a byte array.(package private) org.eclipse.paho.mqttv5.client.DisconnectedBufferOptions
(package private) org.eclipse.paho.mqttv5.client.persist.MemoryPersistence
A topic to service map.
This map is internally used to route a message that arrives at a topic to a service.
This map is populated by the MqttInitializer during the initialization phase.
It is used by the MqttEntryPoint during runtime to invoke the appropriate operation in a service(package private) org.eclipse.paho.mqttv5.client.MqttConnectionOptions
(package private) MqttEntryPoint
(package private) MqttInfoProvider
(package private) MqttInitializer
(package private) MqttPublisher
(package private) MqttSubscriber
mqttSubscriber
(org.eclipse.paho.mqttv5.client.MqttAsyncClient v5Client) (package private) org.eclipse.paho.mqttv5.client.MqttAsyncClient
mqttV5Client
(Map<String, String> mqttConnectionDetails, org.eclipse.paho.mqttv5.client.MqttConnectionOptions connOpts, org.eclipse.paho.mqttv5.client.persist.MemoryPersistence persistence, org.eclipse.paho.mqttv5.client.DisconnectedBufferOptions disconnectedBufferOptions) (package private) org.eclipse.paho.mqttv5.common.MqttMessage
willMessage
(org.eclipse.paho.mqttv5.client.MqttConnectionOptions options)
-
Field Details
-
logger
org.slf4j.Logger logger -
hostURI
-
basePublishTopic
This is the base publish topic that will be pre-pended to publish messages. This can contain specific expressions such as {tenantId} for example which will be substituted by the actual tenantId at the time of publishing a message. This value may not be the same as the base subscribe topic because publishing happens at runtime while subscription happens during startup. Hence, subscription can contain wild cards (such as +) whereas publishing may include expressions that will be substituted from the headers (such as tenant Id etc.) But if it is a constant expression they both can be the same. (default: chenile) -
baseSubscribeTopic
This is the base topic name that will pre-pended for all subscriptions. It can contain wild cards such as + in accordance with the MQ-TT subscription rules . (default: chenile) -
willPayload
-
willQos
-
willRetained
-
willTopic
-
clientID
-
actionTimeout
-
mqttEnabled
-
sessionExpiry
-
-
Constructor Details
-
MqttConfiguration
public MqttConfiguration()
-
-
Method Details
-
mqttConnectionDetails
-
convertStringToBytes
This converts a string to a byte array. This is required to convert the password which is given in the properties file as a string to a byte array that can be set in conn opts- Returns:
-
mqttConnectionOpts
@Bean @ConfigurationProperties(prefix="mqtt.connection") org.eclipse.paho.mqttv5.client.MqttConnectionOptions mqttConnectionOpts() -
willMessage
@Bean org.eclipse.paho.mqttv5.common.MqttMessage willMessage(@Autowired org.eclipse.paho.mqttv5.client.MqttConnectionOptions options) -
memoryPersistence
-
disconnectedBufferOptions
@Bean @ConfigurationProperties(prefix="mqtt.disconnected.buffer") org.eclipse.paho.mqttv5.client.DisconnectedBufferOptions disconnectedBufferOptions() -
mqttV5Client
@Bean org.eclipse.paho.mqttv5.client.MqttAsyncClient mqttV5Client(@Autowired @Qualifier("mqttConnectionDetails") Map<String, String> mqttConnectionDetails, @Autowired org.eclipse.paho.mqttv5.client.MqttConnectionOptions connOpts, @Autowired org.eclipse.paho.mqttv5.client.persist.MemoryPersistence persistence, @Autowired org.eclipse.paho.mqttv5.client.DisconnectedBufferOptions disconnectedBufferOptions) throws org.eclipse.paho.mqttv5.common.MqttException- Throws:
org.eclipse.paho.mqttv5.common.MqttException
-
mqttSubscriber
@Bean MqttSubscriber mqttSubscriber(@Autowired org.eclipse.paho.mqttv5.client.MqttAsyncClient v5Client) -
mqttPublisher
-
mqttEntryPoint
-
mqttInitializer
-
mqttConfig
A topic to service map.
This map is internally used to route a message that arrives at a topic to a service.
This map is populated by the MqttInitializer during the initialization phase.
It is used by the MqttEntryPoint during runtime to invoke the appropriate operation in a service- Returns:
- a configuration that maps a route to a service.
-
mqttInfoProvider
-