camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r986936 - in /websites/production/camel/content: cache/main.pageCache cdi.html
Date Thu, 28 Apr 2016 13:18:54 GMT
Author: buildbot
Date: Thu Apr 28 13:18:54 2016
New Revision: 986936

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/cdi.html

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/cdi.html
==============================================================================
--- websites/production/camel/content/cdi.html (original)
+++ websites/production/camel/content/cdi.html Thu Apr 28 13:18:54 2016
@@ -40,6 +40,7 @@
   <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' rel='stylesheet'
type='text/css' />
   <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' type='text/javascript'></script>
   <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
+  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
   <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
   <script src='//camel.apache.org/styles/highlighter/scripts/shBrushBash.js' type='text/javascript'></script>
   
@@ -137,7 +138,7 @@ class CustomCamelContext extends Default
         // ...
     }
 }]]></script>
-</div></div></div><p><a shape="rect" class="external-link" href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#producer_method"
rel="nofollow">Producer</a>&#160;and&#160;<a shape="rect" class="external-link"
href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#disposer_method" rel="nofollow">disposer</a>&#160;methods
can also be used as well to customize the Camel context bean, e.g.:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p><a shape="rect" class="external-link" href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#producer_method"
rel="nofollow">Producer</a>&#160;and&#160;<a shape="rect" class="external-link"
href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#disposer_method" rel="nofollow">disposer</a>&#160;methods
can also be used as well to customize the Camel context bean, e.g.:</p></div><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[class
CamelContextFactory {
 
     @Produces
@@ -430,7 +431,37 @@ void observeCdiEvents(@Observes @Context
 <script class="brush: text; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[cdi-event://PayloadType&lt;T1,...,Tn&gt;[?qualifiers=QualifierType1[,...[,QualifierTypeN]...]]]]></script>
 </div></div><p>With the authority&#160;<code>PayloadType</code>&#160;(resp.
the&#160;<code>QualifierType</code>) being the URI escaped fully qualified
name of the payload (resp. qualifier) raw type followed by the type parameters section delimited
by angle brackets for payload parameterized type. Which leads to&#160;<em>unfriendly</em>&#160;URIs,
e.g.:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
 <script class="brush: text; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[cdi-event://org.apache.camel.cdi.example.EventPayload%3Cjava.lang.Integer%3E?qualifiers=org.apache.camel.cdi.example.FooQualifier%2Corg.apache.camel.cdi.example.BarQualifier]]></script>
-</div></div><p>But more fundamentally, that would prevent efficient binding
between the 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.</p><h3
id="CDI-Auto-configuredOSGiintegration">Auto-configured OSGi integration</h3><p><strong>Available
as of Camel 2.17</strong></p><p>The Camel context beans are automatically
adapted by Camel CDI so that they are registered as OSGi services and the various resolvers
(like&#160;<code>ComponentResolver</code> and&#160;<code>DataFormatResolver</code>)
integrate with the OSGi registry. That means that the <a shape="rect" href="karaf.html#Karaf-Karafcommands">Karaf
Camel commands</a> can be used to operate the Camel contexts auto-configured by Camel
CDI, e.g.:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+</div></div><p>But more fundamentally, that would prevent efficient binding
between the 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.</p><h3
id="CDI-CamelXMLconfigurationimport">Camel XML configuration import</h3><p><strong>Available
as of Camel 2.18</strong></p><p>While CDI favors a typesafe dependency injection
mechanism, it may be useful&#160;to reuse existing Camel XML configuration files into
a Camel CDI application.&#160;In other use cases, it might be handy to rely on the Camel
XML DSL to configure&#160;its Camel context(s).</p><p>You can use the&#160;<code>@ImportResource</code>
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.:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[@ImportResource(&quot;camel-context.xml&quot;)
+class MyBean {
+}]]></script>
+</div></div><p>Camel CDI will load the resources at the specified locations
from the classpath (other protocols may be added in the future).</p><p>Every <code>CamelContext</code>
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 <code>id</code> attribute set, the corresponding CDI bean is qualified
with the <code>@Named</code> qualifier, e.g., given the following Camel XML configuration:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;camelContext
id=&quot;foo&quot;&gt;
+    &lt;endpoint id=&quot;bar&quot; uri=&quot;seda:inbound&quot;&gt;
+        &lt;property key=&quot;queue&quot; value=&quot;#queue&quot;/&gt;
+        &lt;property key=&quot;concurrentConsumers&quot; value=&quot;10&quot;/&gt;
+    &lt;/endpoint&gt;
+&lt;camelContext/&gt;]]></script>
+</div></div><p>The&#160;<span style="color: rgb(71,71,71);">corresponding
CDI beans are automatically deployed and can be injected, e.g.:</span></p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[@Inject
+@ContextName(&quot;foo&quot;)
+CamelContext context;
+
+@Inject
+@Named(&quot;bar&quot;)
+Endpoint endpoint;]]></script>
+</div></div><p><span style="color: rgb(71,71,71);"><span style="color:
rgb(71,71,71);">Note that the&#160;</span><code>CamelContext</code><span
style="color: rgb(71,71,71);">&#160;beans are automatically qualified with both the&#160;</span><code>Named</code><span
style="color: rgb(71,71,71);">&#160;and&#160;</span><code>ContextName</code><span
style="color: rgb(71,71,71);">&#160;qualifiers. If the imported&#160;</span><code>CamelContext</code><span
style="color: rgb(71,71,71);">&#160;element doesn't have an&#160;</span><code>id</code><span
style="color: rgb(71,71,71);">&#160;attribute, the corresponding bean is deployed with
the built-in&#160;</span><code>Default</code><span style="color:
rgb(71,71,71);">&#160;qualifier.</span></span></p><p>Conversely,
CDI beans deployed in the application can be referred to from the Camel XML configuration,
usually using the&#160;<code>ref</code>&#160;attribute, e.g., given the
following bean declared:</p><div class="code panel pdl" style="border-w
 idth: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[@Produces
+@Named(&quot;baz&quot;)
+Processor processor = exchange -&gt; exchange.getIn().setHeader(&quot;qux&quot;,
&quot;quux&quot;);]]></script>
+</div></div><p><span style="color: rgb(71,71,71);">A reference to
that bean can be declared in the imported Camel XML configuration, e.g.:</span></p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
+<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;camelContext
id=&quot;foo&quot;&gt;
+    &lt;route&gt;
+        &lt;from uri=&quot;...&quot;/&gt;
+        &lt;process ref=&quot;baz&quot;/&gt;
+    &lt;/route&gt;
+&lt;camelContext/&gt;]]></script>
+</div></div><h3 id="CDI-Auto-configuredOSGiintegration">Auto-configured
OSGi integration</h3><p><strong>Available as of Camel 2.17</strong></p><p>The
Camel context beans are automatically adapted by Camel CDI so that they are registered as
OSGi services and the various resolvers (like&#160;<code>ComponentResolver</code>
and&#160;<code>DataFormatResolver</code>) integrate with the OSGi registry.
That means that the <a shape="rect" href="karaf.html#Karaf-Karafcommands">Karaf Camel
commands</a> can be used to operate the Camel contexts auto-configured by Camel CDI,
e.g.:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
 <script class="brush: text; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[karaf@root()&gt;
camel:context-list
  Context        Status              Total #       Failed #     Inflight #   Uptime      
 
  -------        ------              -------       --------     ----------   ------      
 
@@ -479,7 +510,7 @@ for (CamelContext context : contexts)
     context.setUseBreadcrumb(true);]]></script>
 </div></div></div></div></div><h3 id="CDI-MavenArchetype">Maven
Archetype</h3><p>Among the available&#160;<a shape="rect" href="camel-maven-archetypes.html">Camel
Maven archetypes</a>, you can use the provided&#160;<code>camel-archetype-cdi</code>&#160;to
generate a Camel CDI Maven project, e.g.:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <script class="brush: bash; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[mvn
archetype:generate -DarchetypeGroupId=org.apache.camel.archetypes -DarchetypeArtifactId=camel-archetype-cdi]]></script>
-</div></div><h3 id="CDI-Supportedcontainers">Supported containers</h3><p>The
Camel CDI component is compatible with any CDI 1.0, CDI 1.1 and CDI 1.2 compliant runtime.
It's been successfully tested against the following runtimes:</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Container</th><th
colspan="1" rowspan="1" class="confluenceTh">Version</th><th colspan="1" rowspan="1"
class="confluenceTh">Runtime</th></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd">Weld SE</td><td colspan="1" rowspan="1" class="confluenceTd"><code>1.1.28.Final</code></td><td
colspan="1" rowspan="1" class="confluenceTd">CDI 1.0 / Java SE 7</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">OpenWebBeans</td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>1.2.7</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd">CDI 1.0 / Java SE 7</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">Weld S
 E</td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>2.3.3.Final</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd">CDI 1.2 / Java SE 7</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">OpenWebBeans</td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>1.6.3</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd">CDI 1.2 / Java SE 7</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">WildFly</td><td colspan="1" rowspan="1"
class="confluenceTd"><code>8.2.1.Final</code></td><td colspan="1"
rowspan="1" class="confluenceTd">CDI 1.2 / Java EE 7</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">WildFly</td><td colspan="1" rowspan="1"
class="confluenceTd"><code>9.0.1.Final</code></td><td colspan="1"
rowspan="1" class="confluenceTd">CDI 1.2 / Java EE 7</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">Karaf</td><td colspan="1" rowspan="1"
class="confluenceTd"><code>2.4.4</code></td><td colspan="1" rowspan=
 "1" class="confluenceTd">CDI 1.2 / <span>OSGi 4 / PAX CDI</span></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">Karaf</td><td colspan="1" rowspan="1"
class="confluenceTd"><code>3.0.5</code></td><td colspan="1" rowspan="1"
class="confluenceTd">CDI 1.2 / <span>OSGi 5 / PAX CDI</span></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">Karaf</td><td colspan="1" rowspan="1"
class="confluenceTd"><code>4.0.4</code></td><td colspan="1" rowspan="1"
class="confluenceTd">CDI 1.2 / <span>OSGi 6 / PAX CDI</span></td></tr></tbody></table></div><h3
id="CDI-Examples">Examples</h3><p>The following examples are available in the
<code>examples</code> directory of the Camel project:</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Example</th><th
colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-example-cdi</span></code></t
 d><td colspan="1" rowspan="1" class="confluenceTd">Illustrates how to work with
Camel using CDI to configure components, endpoints and beans</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-example-cdi-metrics</span></code></td><td
colspan="1" rowspan="1" class="confluenceTd">Illustrates the integration between Camel,
Dropwizard Metrics and CDI</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-example-cdi-properties</span></code></td><td
colspan="1" rowspan="1" class="confluenceTd">Illustrates the integration between Camel,
DeltaSpike and CDI for configuration properties</td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><code><span>camel-example-cdi-osgi</span></code></td><td
colspan="1" rowspan="1" class="confluenceTd">A&#160;CDI application using the SJMS
component that can be executed inside an OSGi container using PAX CDI</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-exampl
 e-cdi-test</span></code></td><td colspan="1" rowspan="1" class="confluenceTd">Demonstrates
the testing features that are provided as part of the integration between Camel and CDI</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-example-cdi-rest-servlet</span></code></td><td
colspan="1" rowspan="1" class="confluenceTd">Illustrates the Camel REST DSL being used
in a Web application that uses CDI as dependency injection framework</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-example-widget-gadget-cdi</span></code></td><td
colspan="1" rowspan="1" class="confluenceTd">The Widget and Gadget use-case from the EIP
book implemented in Java with CDI dependency injection</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-example-swagger-cdi</span></code></td><td
colspan="1" rowspan="1" class="confluenceTd">An example using REST DSL and Swagger Java
with CDI</td></tr></tbody></table></div><h3 id="CDI-S
 eeAlso">See Also</h3><ul><li><a shape="rect" href="cdi-testing.html">Camel
CDI Testing</a></li><li><a shape="rect" class="external-link" href="http://www.cdi-spec.org"
rel="nofollow">CDI Web site</a></li><li><a shape="rect" class="external-link"
href="http://www.cdi-spec.org/ecosystem/" rel="nofollow">CDI ecosystem</a></li><li><a
shape="rect" class="external-link" href="https://github.com/astefanutti/further-cdi" rel="nofollow">Going
further with CDI</a> (See Camel CDI section)</li></ul></div>
+</div></div><h3 id="CDI-Supportedcontainers">Supported containers</h3><p>The
Camel CDI component is compatible with any CDI 1.0, CDI 1.1 and CDI 1.2 compliant runtime.
It's been successfully tested against the following runtimes:</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Container</th><th
colspan="1" rowspan="1" class="confluenceTh">Version</th><th colspan="1" rowspan="1"
class="confluenceTh">Runtime</th></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd">Weld SE</td><td colspan="1" rowspan="1" class="confluenceTd"><code>1.1.28.Final</code></td><td
colspan="1" rowspan="1" class="confluenceTd">CDI 1.0 / Java SE 7</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">OpenWebBeans</td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>1.2.7</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd">CDI 1.0 / Java SE 7</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">Weld S
 E</td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>2.3.3.Final</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd">CDI 1.2 / Java SE 7</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">OpenWebBeans</td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>1.6.3</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd">CDI 1.2 / Java SE 7</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">WildFly</td><td colspan="1" rowspan="1"
class="confluenceTd"><code>8.2.1.Final</code></td><td colspan="1"
rowspan="1" class="confluenceTd">CDI 1.2 / Java EE 7</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">WildFly</td><td colspan="1" rowspan="1"
class="confluenceTd"><code>9.0.1.Final</code></td><td colspan="1"
rowspan="1" class="confluenceTd">CDI 1.2 / Java EE 7</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">Karaf</td><td colspan="1" rowspan="1"
class="confluenceTd"><code>2.4.4</code></td><td colspan="1" rowspan=
 "1" class="confluenceTd">CDI 1.2 / <span>OSGi 4 / PAX CDI</span></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">Karaf</td><td colspan="1" rowspan="1"
class="confluenceTd"><code>3.0.5</code></td><td colspan="1" rowspan="1"
class="confluenceTd">CDI 1.2 / <span>OSGi 5 / PAX CDI</span></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd">Karaf</td><td colspan="1" rowspan="1"
class="confluenceTd"><code>4.0.4</code></td><td colspan="1" rowspan="1"
class="confluenceTd">CDI 1.2 / <span>OSGi 6 / PAX CDI</span></td></tr></tbody></table></div><h3
id="CDI-Examples">Examples</h3><p>The following examples are available in the
<code>examples</code> directory of the Camel project:</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Example</th><th
colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-example-cdi</span></code></t
 d><td colspan="1" rowspan="1" class="confluenceTd">Illustrates how to work with
Camel using CDI to configure components, endpoints and beans</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-example-cdi-metrics</span></code></td><td
colspan="1" rowspan="1" class="confluenceTd">Illustrates the integration between Camel,
Dropwizard Metrics and CDI</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-example-cdi-properties</span></code></td><td
colspan="1" rowspan="1" class="confluenceTd">Illustrates the integration between Camel,
DeltaSpike and CDI for configuration properties</td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><code><span>camel-example-cdi-osgi</span></code></td><td
colspan="1" rowspan="1" class="confluenceTd">A&#160;CDI application using the SJMS
component that can be executed inside an OSGi container using PAX CDI</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-exampl
 e-cdi-test</span></code></td><td colspan="1" rowspan="1" class="confluenceTd">Demonstrates
the testing features that are provided as part of the integration between Camel and CDI</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-example-cdi-rest-servlet</span></code></td><td
colspan="1" rowspan="1" class="confluenceTd">Illustrates the Camel REST DSL being used
in a Web application that uses CDI as dependency injection framework</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><code>camel-example-cdi-xml</code></td><td
colspan="1" rowspan="1" class="confluenceTd"><span>Illustrates the use of Camel XML
configuration files into a Camel CDI application</span></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><code><span>camel-example-widget-gadget-cdi</span></code></td><td
colspan="1" rowspan="1" class="confluenceTd">The Widget and Gadget use-case from the EIP
book implemented in Java with CDI dependency injection</td></tr><tr><td
c
 olspan="1" rowspan="1" class="confluenceTd"><code><span>camel-example-swagger-cdi</span></code></td><td
colspan="1" rowspan="1" class="confluenceTd">An example using REST DSL and Swagger Java
with CDI</td></tr></tbody></table></div><h3 id="CDI-SeeAlso">See
Also</h3><ul><li><a shape="rect" href="cdi-testing.html">Camel CDI
Testing</a></li><li><a shape="rect" class="external-link" href="http://www.cdi-spec.org"
rel="nofollow">CDI Web site</a></li><li><a shape="rect" class="external-link"
href="http://www.cdi-spec.org/ecosystem/" rel="nofollow">CDI ecosystem</a></li><li><a
shape="rect" class="external-link" href="https://github.com/astefanutti/further-cdi" rel="nofollow">Going
further with CDI</a> (See Camel CDI section)</li></ul></div>
         </td>
         <td valign="top">
           <div class="navigation">



Mime
View raw message