You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2016/05/11 10:02:20 UTC

camel git commit: Added camel-mqtt docs to Gitbook

Repository: camel
Updated Branches:
  refs/heads/master 43408614b -> 238bc54d3


Added camel-mqtt docs to Gitbook


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/238bc54d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/238bc54d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/238bc54d

Branch: refs/heads/master
Commit: 238bc54d31182743e07381daa7fd5796d8f2284f
Parents: 4340861
Author: Andrea Cosentino <an...@gmail.com>
Authored: Wed May 11 12:01:24 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Wed May 11 12:01:24 2016 +0200

----------------------------------------------------------------------
 components/camel-mqtt/src/main/docs/mqtt.adoc | 160 +++++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                |   1 +
 2 files changed, 161 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/238bc54d/components/camel-mqtt/src/main/docs/mqtt.adoc
----------------------------------------------------------------------
diff --git a/components/camel-mqtt/src/main/docs/mqtt.adoc b/components/camel-mqtt/src/main/docs/mqtt.adoc
new file mode 100644
index 0000000..a0ca38c
--- /dev/null
+++ b/components/camel-mqtt/src/main/docs/mqtt.adoc
@@ -0,0 +1,160 @@
+[[MQTT-MQTTComponent]]
+MQTT Component
+~~~~~~~~~~~~~~
+
+*Available as of Camel 2.10*
+
+The *mqtt:* component is used for communicating with
+http://mqtt.org[MQTT] compliant message brokers, like
+http://activemq.apache.org[Apache ActiveMQ] or
+http://mosquitto.org[Mosquitto]
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-mqtt</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+[[MQTT-URIformat]]
+URI format
+^^^^^^^^^^
+
+[source,java]
+---------------------
+mqtt://name[?options]
+---------------------
+
+Where *name* is the name you want to assign the component.
+
+[[MQTT-Options]]
+Options
+^^^^^^^
+
+
+// component options: START
+The MQTT component supports 3 options which are listed below.
+
+
+
+[width="100%",cols="2s,1m,8",options="header"]
+|=======================================================================
+| Name | Java Type | Description
+| host | String | The URI of the MQTT broker to connect too - this component also supports SSL - e.g. ssl://127.0.0.1:8883
+| userName | String | Username to be used for authentication against the MQTT broker
+| password | String | Password to be used for authentication against the MQTT broker
+|=======================================================================
+// component options: END
+
+
+
+// endpoint options: START
+The MQTT component supports 39 endpoint options which are listed below:
+
+[width="100%",cols="2s,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| name | common |  | String | *Required* A logical name to use which is not the topic name.
+| blockingExecutor | common |  | Executor | SSL connections perform blocking operations against internal thread pool unless you call the setBlockingExecutor method to configure that executor they will use instead.
+| byDefaultRetain | common | false | boolean | The default retain policy to be used on messages sent to the MQTT broker
+| cleanSession | common | false | boolean | Set to false if you want the MQTT server to persist topic subscriptions and ack positions across client sessions. Defaults to true.
+| clientId | common |  | String | Use to set the client Id of the session. This is what an MQTT server uses to identify a session where setCleanSession(false); is being used. The id must be 23 characters or less. Defaults to auto generated id (based on your socket address port and timestamp).
+| connectAttemptsMax | common | -1 | long | The maximum number of reconnect attempts before an error is reported back to the client on the first attempt by the client to connect to a server. Set to -1 to use unlimited attempts. Defaults to -1.
+| connectWaitInSeconds | common | 10 | int | Delay in seconds the Component will wait for a connection to be established to the MQTT broker
+| disconnectWaitInSeconds | common | 5 | int | The number of seconds the Component will wait for a valid disconnect on stop() from the MQTT broker
+| dispatchQueue | common |  | DispatchQueue | A HawtDispatch dispatch queue is used to synchronize access to the connection. If an explicit queue is not configured via the setDispatchQueue method then a new queue will be created for the connection. Setting an explicit queue might be handy if you want multiple connection to share the same queue for synchronization.
+| host | common | tcp://127.0.0.1:1883 | URI | The URI of the MQTT broker to connect too - this component also supports SSL - e.g. ssl://127.0.0.1:8883
+| keepAlive | common |  | short | Configures the Keep Alive timer in seconds. Defines the maximum time interval between messages received from a client. It enables the server to detect that the network connection to a client has dropped without having to wait for the long TCP/IP timeout.
+| localAddress | common |  | URI | The local InetAddress and port to use
+| maxReadRate | common |  | int | Sets the maximum bytes per second that this transport will receive data at. This setting throttles reads so that the rate is not exceeded. Defaults to 0 which disables throttling.
+| maxWriteRate | common |  | int | Sets the maximum bytes per second that this transport will send data at. This setting throttles writes so that the rate is not exceeded. Defaults to 0 which disables throttling.
+| mqttQosPropertyName | common | MQTTQos | String | 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.
+| mqttRetainPropertyName | common | MQTTRetain | String | 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.
+| mqttTopicPropertyName | common | MQTTTopicPropertyName | String | These a properties that are looked for in an Exchange - to publish to
+| publishTopicName | common | camel/mqtt/test | String | The default Topic to publish messages on
+| qualityOfService | common | AtLeastOnce | String | Quality of service level to use for topics.
+| receiveBufferSize | common | 65536 | int | Sets the size of the internal socket receive buffer. Defaults to 65536 (64k)
+| reconnectAttemptsMax | common | -1 | long | The maximum number of reconnect attempts before an error is reported back to the client after a server connection had previously been established. Set to -1 to use unlimited attempts. Defaults to -1.
+| reconnectBackOffMultiplier | common | 2.0 | double | The Exponential backoff be used between reconnect attempts. Set to 1 to disable exponential backoff. Defaults to 2.
+| reconnectDelay | common | 10 | long | How long to wait in ms before the first reconnect attempt. Defaults to 10.
+| reconnectDelayMax | common | 30000 | long | The maximum amount of time in ms to wait between reconnect attempts. Defaults to 30000.
+| sendBufferSize | common | 65536 | int | Sets the size of the internal socket send buffer. Defaults to 65536 (64k)
+| sendWaitInSeconds | common | 5 | int | The maximum time the Component will wait for a receipt from the MQTT broker to acknowledge a published message before throwing an exception
+| sslContext | common |  | SSLContext | To configure security using SSLContext configuration
+| subscribeTopicName | common |  | String | These are set on the Endpoint - together with properties inherited from MQTT
+| subscribeTopicNames | common |  | String | A comma-delimited list of Topics to subscribe to for messages. Note that each item of this list can contain MQTT wildcards ( and/or ) in order to subscribe to topics matching a certain pattern within a hierarchy. For example is a wildcard for all topics at a level within the hierarchy so if a broker has topics topics/one and topics/two then topics/ can be used to subscribe to both. A caveat to consider here is that if the broker adds topics/three the route would also begin to receive messages from that topic.
+| trafficClass | common | 8 | int | Sets traffic class or type-of-service octet in the IP header for packets sent from the transport. Defaults to 8 which means the traffic should be optimized for throughput.
+| version | common | 3.1 | String | Set to 3.1.1 to use MQTT version 3.1.1. Otherwise defaults to the 3.1 protocol version.
+| willMessage | common |  | String | The Will message to send. Defaults to a zero length message.
+| willQos | common | AtMostOnce | QoS | Sets the quality of service to use for the Will message. Defaults to AT_MOST_ONCE.
+| willRetain | common |  | QoS | Set to true if you want the Will to be published with the retain option.
+| willTopic | common |  | String | If set the server will publish the client's Will message to the specified topics if the client has an unexpected disconnection.
+| bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
+| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+|=======================================================================
+// endpoint options: END
+
+
+[[MQTT-Samples]]
+Samples
+^^^^^^^
+
+Sending messages:
+
+[source,java]
+----------------------------------------------------------------------
+from("direct:foo").to("mqtt:cheese?publishTopicName=test.mqtt.topic");
+----------------------------------------------------------------------
+
+Consuming messages:
+
+[source,java]
+---------------------------------------------------------------------------------------------------------
+from("mqtt:bar?subscribeTopicName=test.mqtt.topic").transform(body().convertToString()).to("mock:result")
+---------------------------------------------------------------------------------------------------------
+
+[[MQTT-Endpoints]]
+Endpoints
+~~~~~~~~~
+
+Camel supports the link:message-endpoint.html[Message Endpoint] pattern
+using the
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html[Endpoint]
+interface. Endpoints are usually created by a
+link:component.html[Component] and Endpoints are usually referred to in
+the link:dsl.html[DSL] via their link:uris.html[URIs].
+
+From an Endpoint you can use the following methods
+
+* http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createProducer()[createProducer()]
+will create a
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Producer.html[Producer]
+for sending message exchanges to the endpoint
+* http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createConsumer(org.apache.camel.Processor)[createConsumer()]
+implements the link:event-driven-consumer.html[Event Driven Consumer]
+pattern for consuming message exchanges from the endpoint via a
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Processor.html[Processor]
+when creating a
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Consumer.html[Consumer]
+* http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html#createPollingConsumer()[createPollingConsumer()]
+implements the link:polling-consumer.html[Polling Consumer] pattern for
+consuming message exchanges from the endpoint via a
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/PollingConsumer.html[PollingConsumer]
+
+[[MQTT-SeeAlso]]
+See Also
+^^^^^^^^
+
+* link:configuring-camel.html[Configuring Camel]
+* link:message-endpoint.html[Message Endpoint] pattern
+* link:uris.html[URIs]
+* link:writing-components.html[Writing Components]
+

http://git-wip-us.apache.org/repos/asf/camel/blob/238bc54d/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 4e8609c..e805fb5 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -197,6 +197,7 @@
     * [MLLP](mllp.adoc)
     * [MongoDB](mongodb.adoc)
     * [MongoDB-GridFS](gridfs.adoc)
+    * [MQTT](mqtt.adoc)
     * [Mock](mock.adoc)
     * [NATS](nats.adoc)
     * [Properties](properties.adoc)