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

[camel] branch master updated: Add componendsl example in the walkthrough example

This is an automated email from the ASF dual-hosted git repository.

oalsafi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new da6c688  Add componendsl example in the walkthrough example
da6c688 is described below

commit da6c6880ae7c3aa5726333ca552a41bdbeb85c8d
Author: Omar Al-Safi <om...@gmail.com>
AuthorDate: Wed Feb 5 11:38:35 2020 +0100

    Add componendsl example in the walkthrough example
---
 .../ROOT/pages/walk-through-an-example.adoc        | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/docs/user-manual/modules/ROOT/pages/walk-through-an-example.adoc b/docs/user-manual/modules/ROOT/pages/walk-through-an-example.adoc
index 8b093bb..1aafa7e 100644
--- a/docs/user-manual/modules/ROOT/pages/walk-through-an-example.adoc
+++ b/docs/user-manual/modules/ROOT/pages/walk-through-an-example.adoc
@@ -36,6 +36,28 @@ or explicitly - as we do here when we add the JMS Component:
 include::{examplesdir}/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java[tags=e2]
 ----
 
+or explicitly using the Component DSL which allows you to configure the components using DSL APIs and register them to the camel context. First you will have the import the maven package for the Component DSL:
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-componentdsl</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+and the register the component like this:
+[source,java]
+----
+ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
+
+ComponentsBuilderFactory.jms()
+         .connectionFactory(connectionFactory)
+         .acknowledgementMode(1)
+         .register(context, "test-jms");
+----
+
 The above works with any JMS provider. If we know we are using
 xref:components::activemq-component.adoc[ActiveMQ] we can use an even simpler form using the
 http://activemq.apache.org/maven/5.5.0/activemq-camel/apidocs/org/apache/activemq/camel/component/ActiveMQComponent.html#activeMQComponent%28java.lang.String%29[`activeMQComponent()`