Available as of Camel 2.10
The mqtt: component is used for communicating with MQTT compliant message brokers, like Apache ActiveMQ or Mosquitto
Camel will poll the feed every 60 seconds by default.
Note: The component currently only supports polling (consuming) feeds.
Maven users will need to add the following dependency to their
pom.xml for this component:
Where name is the name you want to assign the component.
The URI of the MQTT broker to connect too - this component also supports SSL - e.g. ssl://127.0.0.1:8883
The local InetAddress and port to use
| ||userName to be used for authentication against the MQTT broker|
| ||password to be used for authentication against the MQTT broker|
The maximum number of attempts to establish an initial connection - -1 in infinite.
The maximum number of attempts to re-establish a connection after failure - -1 in infinite.
The time in milliseconds between attempts to reestablish an initial or failed connection
The multiplier to use to the delay between connection attempts for successive failed connection attempts
The maximum time in milliseconds between a new attempt to establish a connection. So even using the reconnectBackOffMultiplier, this property will define the maximum delay before another connection attempt to the MQTT broker
The MQTT Quality of Service to use for message exchanges. It can be one of AtMostOnce, AtLeastOnce or ExactlyOnce
The name of the Topic to subscribe to for messages
The default Topic to publish messages on
The default retain policy to be used on messages sent to the MQTT broker
The property name to look for on an Exchange for an individual published message. If this is set - the name will be used as the Topic to publish a message to the MQTT message broker. This option is removed since camel 2.14.0.
Since Camel 2.14.0, Camel uses "CamelMQTTSubscribeTopic" to store the topic name of the MQTT consumer into the message header, and "CamelMQTTPublishTopic" to look up the topic name of the MQTT producer from the message header.
The property name to look for on an Exchange for an individual published message. If this is set (expects a Boolean value) - then the retain property will be set on the message sent to the MQTT message broker.
The property name to look for on an Exchange for an individual published message. If this is set (one of AtMostOnce, AtLeastOnce or ExactlyOnce ) - then that QoS will be set on the message sent to the MQTT message broker.
Delay in seconds the Component will wait for a connection to be established to the MQTT broker
the number of seconds the Component will wait for a valid disconnect on stop() from the MQTT broker
The maximum time the Component will wait for a receipt from the MQTT broker to acknowledge a published message before throwing an exception
You can append query options to the URI in the following format,
Camel supports the Message Endpoint pattern using the Endpoint interface. Endpoints are usually created by a Component and Endpoints are usually referred to in the DSL via their URIs.
From an Endpoint you can use the following methods