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/01/25 17:57:47 UTC
camel git commit: Add Camel-amqp gitbook docs
Repository: camel
Updated Branches:
refs/heads/master 93a41f6f5 -> d5fc6d6af
Add Camel-amqp gitbook docs
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d5fc6d6a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d5fc6d6a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d5fc6d6a
Branch: refs/heads/master
Commit: d5fc6d6af3d085c812e548c630b208fd05239860
Parents: 93a41f6
Author: Andrea Cosentino <an...@gmail.com>
Authored: Mon Jan 25 17:56:58 2016 +0100
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Mon Jan 25 17:56:58 2016 +0100
----------------------------------------------------------------------
components/camel-amqp/src/main/docs/readme.adoc | 168 +++++++++++++++++++
docs/user-manual/en/SUMMARY.md | 1 +
2 files changed, 169 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d5fc6d6a/components/camel-amqp/src/main/docs/readme.adoc
----------------------------------------------------------------------
diff --git a/components/camel-amqp/src/main/docs/readme.adoc b/components/camel-amqp/src/main/docs/readme.adoc
new file mode 100644
index 0000000..5526dce
--- /dev/null
+++ b/components/camel-amqp/src/main/docs/readme.adoc
@@ -0,0 +1,168 @@
+[[AMQP-AMQP]]
+AMQP
+~~~~
+
+The *amqp:* component supports the http://www.amqp.org/[AMQP 1.0
+protocol] using the JMS Client API of the http://qpid.apache.org/[Qpid]
+project. In case you want to use AMQP 0.9 (in particular RabbitMQ) you
+might also be interested in the link:rabbitmq.html[Camel RabbitMQ]
+component. Please keep in mind that prior to the Camel 2.17.0 AMQP
+component supported AMQP 0.9 and above, however since Camel 2.17.0 it
+supports only AMQP 1.0.
+
+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-amqp</artifactId>
+ <version>${camel.version}</version> <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------------------------------------------
+
+[[AMQP-URIformat]]
+URI format
+^^^^^^^^^^
+
+[source,java]
+---------------------------------------------
+amqp:[queue:|topic:]destinationName[?options]
+---------------------------------------------
+
+[[AMQP-AMQPOptions]]
+AMQP Options
+^^^^^^^^^^^^
+
+You can specify all of the various configuration options of the
+link:../../../../camel-jms/src/main/docs/readme.html[JMS] component after the destination name.
+
+[[AMQP-Usage]]
+Usage
+^^^^^
+
+As AMQP component is inherited from JMS component, the usage of the
+former is almost identical to the latter:
+
+*Using AMQP component*
+
+[source,java]
+------------------------------------
+// Consuming from AMQP queue
+from("amqp:queue:incoming").
+ to(...);
+
+// Sending message to the AMQP topic
+from(...).
+ to("amqp:topic:notify");
+------------------------------------
+
+[[AMQP-ConfiguringAMQPcomponent]]
+Configuring AMQP component
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Starting from the Camel 2.16.1 you can also use the
+`AMQPComponent#amqp10Component(String connectionURI)` factory method to
+return the AMQP 1.0 component with the pre-configured topic prefix:
+
+*Creating AMQP 1.0 component*
+
+[source,java]
+-----------------------------------------------------------------------------------------
+ AMQPComponent amqp = AMQPComponent.amqp10Component("amqp://guest:guest@localhost:5672");
+-----------------------------------------------------------------------------------------
+
+Keep in mind that starting from the
+Camel 2.17 the `AMQPComponent#amqp10Component(String connectionURI)` factory
+method has been deprecated on the behalf of the
+`AMQPComponent#amqpComponent(String connectionURI)`:
+
+*Creating AMQP 1.0 component*
+
+[source,java]
+--------------------------------------------------------------------------------------------------------
+AMQPComponent amqp = AMQPComponent.amqpComponent("amqp://localhost:5672");
+
+AMQPComponent authorizedAmqp = AMQPComponent.amqpComponent("amqp://localhost:5672", "user", "password");
+--------------------------------------------------------------------------------------------------------
+
+Starting from Camel 2.17, in order to automatically configure the AMQP
+component, you can also add an instance
+of `org.apache.camel.component.amqp.AMQPConnectionDetails` to the
+registry. For example for Spring Boot you just have to define bean:
+
+*AMQP connection details auto-configuration*
+
+[source,java]
+-------------------------------------------------------------------------------------
+@Bean
+AMQPConnectionDetails amqpConnection() {
+ return new AMQPConnectionDetails("amqp://lcoalhost:5672");
+}
+
+@Bean
+AMQPConnectionDetails securedAmqpConnection() {
+ return new AMQPConnectionDetails("amqp://lcoalhost:5672", "username", "password");
+}
+-------------------------------------------------------------------------------------
+
+
+
+You can also rely on the link:properties.html[Camel properties] to read
+the AMQP connection details. Factory
+method `AMQPConnectionDetails.discoverAMQP()` attempts to read Camel
+properties in a Kubernetes-like convention, just as demonstrated on the
+snippet below:
+
+
+
+*AMQP connection details auto-configuration*
+
+[source,java]
+-----------------------------------------------
+export AMQP_SERVICE_HOST = "mybroker.com"
+export AMQP_SERVICE_PORT = "6666"
+export AMQP_SERVICE_USERNAME = "username"
+export AMQP_SERVICE_PASSWORD = "password"
+
+...
+
+@Bean
+AMQPConnectionDetails amqpConnection() {
+ return AMQPConnectionDetails.discoverAMQP();
+}
+-----------------------------------------------
+
+[[AMQP-Usingtopics]]
+Using topics
+^^^^^^^^^^^^
+
+To have using topics working with `camel-amqp` you need to configure the
+component to use `topic://` as topic prefix, as shown below:
+
+[source,java]
+-------------------------------------------------------------------------------------------------------------------------------
+ <bean id="amqp" class="org.apache.camel.component.amqp.AmqpComponent">
+ <property name="connectionFactory">
+ <bean class="org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl" factory-method="createFromURL">
+ <constructor-arg index="0" type="java.lang.String" value="amqp://localhost:5672" />
+ <property name="topicPrefix" value="topic://" /> <!-- only necessary when connecting to ActiveMQ over AMQP 1.0 -->
+ </bean>
+ </property>
+ </bean>
+-------------------------------------------------------------------------------------------------------------------------------
+
+Keep in mind that both `AMQPComponent#amqpComponent()` methods and
+`AMQPConnectionDetails` pre-configure the component with the topic
+prefix, so you don't have to configure it explicitly.
+
+[[AMQP-SeeAlso]]
+See Also
+^^^^^^^^
+
+* link:configuring-camel.html[Configuring Camel]
+* link:component.html[Component]
+* link:endpoint.html[Endpoint]
+* link:getting-started.html[Getting Started]
+
http://git-wip-us.apache.org/repos/asf/camel/blob/d5fc6d6a/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 27d1376..1c653fd 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -5,6 +5,7 @@
* Components References
* [Async Http Client (AHC)](components/camel-ahc/src/main/docs/readme.adoc)
* [AHC Websocket (AHC-WS)](components/camel-ahc-ws/src/main/docs/readme.adoc)
+ * [Amqp](components/camel-amqp/src/main/docs/readme.adoc)
* [Atom](components/camel-atom/src/main/docs/readme.adoc)
* [CDI](components/camel-cdi/src/main/docs/readme.adoc)
* [JMS](components/camel-jms/src/main/docs/readme.adoc)