You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2016/04/28 15:56:16 UTC

[1/2] camel git commit: CAMEL-9882: Add documentation

Repository: camel
Updated Branches:
  refs/heads/master cbeab0e14 -> 23420ceaa


CAMEL-9882: Add documentation


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

Branch: refs/heads/master
Commit: 9c5dee79a4bca5929d3980e0b9eb6790cc7c5c72
Parents: cbeab0e
Author: Antonin Stefanutti <an...@stefanutti.fr>
Authored: Thu Apr 28 15:54:46 2016 +0200
Committer: Antonin Stefanutti <an...@stefanutti.fr>
Committed: Thu Apr 28 15:54:46 2016 +0200

----------------------------------------------------------------------
 components/camel-cdi/src/main/docs/cdi.adoc | 99 +++++++++++++++++++++++-
 1 file changed, 95 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/9c5dee79/components/camel-cdi/src/main/docs/cdi.adoc
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/main/docs/cdi.adoc b/components/camel-cdi/src/main/docs/cdi.adoc
index 8f49cf9..378d1ff 100644
--- a/components/camel-cdi/src/main/docs/cdi.adoc
+++ b/components/camel-cdi/src/main/docs/cdi.adoc
@@ -147,8 +147,8 @@ class CustomCamelContext extends DefaultCamelContext {
 ----
 
 link:http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#producer_method[Producer]
-and link:http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#disposer_method[disposer] methods
-can also be used as well to customize the Camel context bean, e.g.:
+and link:http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#disposer_method[disposer]
+methods can also be used as well to customize the Camel context bean, e.g.:
 
 [source,java]
 ----
@@ -271,8 +271,9 @@ Camel contexts. That may be useful, for example, for Camel routes that
 may be required to be added later during the application execution.
 
 NOTE: Since Camel version 2.17.0, Camel CDI is capable of managing any kind of
-`CamelContext` beans (e.g. `DefaultCamelContext`). In previous versions, it is only capable of managing beans
-of type `CdiCamelContext` so it is required to extend it.
+`CamelContext` beans (e.g. `DefaultCamelContext`). In previous versions,
+it is only capable of managing beans of type `CdiCamelContext` so it is
+required to extend it.
 
 The CDI qualifiers declared on the `CamelContext` beans are also used to
 bind the corresponding Camel primitives, e.g.:
@@ -769,6 +770,92 @@ endpoint instances and the observer methods as the CDI container doesn't
 have any ways of discovering the Camel context model during the
 deployment phase.
 
+[[CDI-CamelXMLconfigurationimport]]
+Camel XML configuration import
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+*Available as of Camel 2.18*
+
+While CDI favors a typesafe dependency injection mechanism, it may be
+useful to reuse existing Camel XML configuration files into a Camel CDI
+application. In other use cases, it might be handy to rely on the Camel
+XML DSL to configure its Camel context(s).
+
+You can use the `@ImportResource` annotation that's provided by Camel
+CDI on any CDI beans and Camel CDI will automatically load the Camel XML
+configuration at the specified locations, e.g.:
+
+[source,java]
+----
+@ImportResource("camel-context.xml")
+class MyBean {
+}
+----
+
+Camel CDI will load the resources at the specified locations from the
+classpath (other protocols may be added in the future).
+
+Every `CamelContext` elements and other Camel _primitives_ from the
+imported resources are automatically deployed as CDI beans during the
+container bootstrap so that they benefit from the auto-configuration
+provided by Camel CDI and become available for injection at runtime. If
+such an element has an explicit `id` attribute set, the corresponding
+CDI bean is qualified with the `@Named` qualifier, e.g., given the
+following Camel XML configuration:
+
+[source,xml]
+----
+<camelContext id="foo">
+    <endpoint id="bar" uri="seda:inbound">
+        <property key="queue" value="#queue"/>
+        <property key="concurrentConsumers" value="10"/>
+    </endpoint>
+<camelContext/>
+----
+
+The corresponding CDI beans are automatically deployed and can be
+injected, e.g.:
+
+[source,java]
+----
+@Inject
+@ContextName("foo")
+CamelContext context;
+
+@Inject
+@Named("bar")
+Endpoint endpoint;
+----
+
+Note that the `CamelContext` beans are automatically qualified with both
+the `@Named` and `@ContextName` qualifiers. If the
+imported `CamelContext` element doesn't have an `id` attribute, the
+corresponding bean is deployed with the built-in `@Default` qualifier.
+
+Conversely, CDI beans deployed in the application can be referred to
+from the Camel XML configuration, usually using the `ref` attribute,
+e.g., given the following bean declared:
+
+[source,java]
+----
+@Produces
+@Named("baz")
+Processor processor = exchange -> exchange.getIn().setHeader("qux", "quux");
+----
+
+A reference to that bean can be declared in the imported Camel XML
+configuration, e.g.:
+
+[source,xml]
+----
+<camelContext id="foo">
+    <route>
+        <from uri="..."/>
+        <process ref="baz"/>
+    </route>
+<camelContext/>
+----
+
 [[CDI-Auto-configuredOSGiintegration]]
 Auto-configured OSGi integration
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -949,6 +1036,10 @@ uses CDI as dependency injection framework
 |Demonstrates the testing features that are provided as part of
 the integration between Camel and CDI
 
+|camel-example-cdi-xml
+|Illustrates the use of Camel XML configuration
+files into a Camel CDI application
+
 |camel-example-swagger-cdi
 |An example using REST DSL and Swagger Java with CDI
 


[2/2] camel git commit: Camel CDI: update tested containers in documentation

Posted by as...@apache.org.
Camel CDI: update tested containers in documentation


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

Branch: refs/heads/master
Commit: 23420ceaa1357199182bcb0dc64c344e289b415e
Parents: 9c5dee7
Author: Antonin Stefanutti <an...@stefanutti.fr>
Authored: Thu Apr 28 15:56:07 2016 +0200
Committer: Antonin Stefanutti <an...@stefanutti.fr>
Committed: Thu Apr 28 15:56:07 2016 +0200

----------------------------------------------------------------------
 components/camel-cdi/src/main/docs/cdi.adoc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/23420cea/components/camel-cdi/src/main/docs/cdi.adoc
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/main/docs/cdi.adoc b/components/camel-cdi/src/main/docs/cdi.adoc
index 378d1ff..94f7078 100644
--- a/components/camel-cdi/src/main/docs/cdi.adoc
+++ b/components/camel-cdi/src/main/docs/cdi.adoc
@@ -993,10 +993,11 @@ following runtimes:
 |Container |Version |Runtime
 |Weld SE |1.1.28.Final |CDI 1.0 / Java SE 7
 |OpenWebBeans |1.2.7 |CDI 1.0 / Java SE 7
-|Weld SE |2.3.3.Final |CDI 1.2 / Java SE 7
+|Weld SE |2.3.4.Final |CDI 1.2 / Java SE 7
 |OpenWebBeans |1.6.3 |CDI 1.2 / Java SE 7
 |WildFly |8.2.1.Final |CDI 1.2 / Java EE 7
 |WildFly |9.0.1.Final |CDI 1.2 / Java EE 7
+|WildFly |10.0.0.Final |CDI 1.2 / Java EE 7
 |Karaf |2.4.4 |CDI 1.2 / OSGi 4 / PAX CDI
 |Karaf |3.0.5 |CDI 1.2 / OSGi 5 / PAX CDI
 |Karaf |4.0.4 |CDI 1.2 / OSGi 6 / PAX CDI