Author: buildbot Date: Fri Feb 26 11:19:57 2016 New Revision: 981204 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 Fri Feb 26 11:19:57 2016 @@ -357,7 +357,7 @@ PlatformTransactionManager createTransac void onContextStarted(@Observes @Manual CamelContextStartedEvent event) { // Called after the the Camel context qualified with '@Manual' has started }]]></script> -</div></div><p>Similarly, the <code>@Default</code> qualifier can be used to observe Camel events for the <em>default</em> Camel context if multiples contexts exist, e.g.:</p><div class="highlight highlight-source-java"><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>Similarly, the <code>@Default</code> qualifier can be used to observe Camel events for the <em>default</em> Camel context if multiples contexts exist, e.g.:</p><div class="highlight highlight-source-java"><p> </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[void onExchangeCompleted(@Observes @Default ExchangeCompletedEvent event) { // Called after the exchange 'event.getExchange()' processing has completed }]]></script> @@ -429,7 +429,49 @@ void observeCdiEvents(@Observes @Context Context Status Total # Failed # Inflight # Uptime ------- ------ ------- -------- ---------- ------ camel-cdi Started 1 0 0 1 minute ]]></script> -</div></div><p>See the <span><code>camel-example-cdi-osgi</code> example for a working example of the Camel CDI OSGi integration.</span></p><h3 id="CDI-MavenArchetype">Maven Archetype</h3><p>Among the available <a shape="rect" href="camel-maven-archetypes.html">Camel Maven archetypes</a>, you can use the provided <code>camel-archetype-cdi</code> to generate a Camel CDI Maven project, e.g.:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>See the <span><code>camel-example-cdi-osgi</code> example for a working example of the Camel CDI OSGi integration.</span></p><h3 id="CDI-LazyInjection/ProgrammaticLookup">Lazy Injection / Programmatic Lookup</h3><p><strong>Available as of Camel 2.17</strong></p><p>While the CDI programmatic model favors a <a shape="rect" class="external-link" href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#typesafe_resolution" style="text-decoration: underline;" rel="nofollow">type-safe resolution</a> mechanism that occurs at application initialization time, it is possible to perform dynamic / lazy injection later during the application execution using the <a shape="rect" class="external-link" href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#programmatic_lookup" style="text-decoration: underline;" rel="nofollow">programmatic lookup</a> mechanism.</p><p>Camel CDI provides for convenience the annotation literals corresponding to the CDI qualifiers t hat you can use for standard injection of Camel primitives. These annotation literals can be used in conjunction with the<code>javax.enterprise.inject.Instance</code> interface which is the CDI entry point to perform lazy injection / programmatic lookup.</p><p>For example, you can use the provided annotation literal for the <code>@Uri</code>qualifier to lazily lookup for Camel primitives, e.g. for <code>ProducerTemplate</code>beans:</p><div class="listingblock"><div class="content"><div class="line"><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[@Any +@Inject +Instance<ProducerTemplate> producers; + +ProducerTemplate inbound = producers + .select(Uri.Literal.of("direct:inbound")) + .get();]]></script> +</div></div></div><div class="line">Or for <code>Endpoint</code> beans, e.g.:</div></div></div><div class="paragraph"><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[@Any +@Inject +Instance<Endpoint> endpoints; + +MockEndpoint outbound = endpoints + .select(MockEndpoint.class, Uri.Literal.of("mock:outbound")) + .get();]]></script> +</div></div></div><div class="paragraph"><p>Similarly, you can use the provided annotation literal for the<code>@ContextName</code> qualifier to lazily lookup for <code>CamelContext</code> beans, e.g.:</p></div><div class="listingblock"><div class="content"><div class="line"><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[@Any +@Inject +Instance<CamelContext> contexts; + +CamelContext context = contexts + .select(ContextName.Literal.of("foo")) + .get();]]></script> +</div></div></div></div></div><div class="paragraph"><p>You can also refined the selection based on the Camel context type, e.g.:</p></div><div class="listingblock"><div class="content"><div class="line"><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[@Any +@Inject +Instance<CamelContext> contexts; + +// Refine the selection by type +Instance<DefaultCamelContext> context = contexts.select(DefaultCamelContext.class); + +// Check if such a bean exists then retrieve a reference +if (!context.isUnsatisfied()) + context.get();]]></script> +</div></div></div></div></div><div class="paragraph"><p>Or even iterate over a selection of Camel contexts, e.g.:</p></div><div class="listingblock"><div class="content"><div class="line"><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[@Any +@Inject +Instance<CamelContext> contexts; + +for (CamelContext context : contexts) + context.setUseBreadcrumb(true);]]></script> +</div></div></div></div></div><h3 id="CDI-MavenArchetype">Maven Archetype</h3><p>Among the available <a shape="rect" href="camel-maven-archetypes.html">Camel Maven archetypes</a>, you can use the provided <code>camel-archetype-cdi</code> 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><ul><li><code><code>camel-example-cdi</code></code> - illustrates how to work with Camel using CDI to configure components, endpoints and beans,</li><li><code>camel-example-cdi-metrics</code> - illustrates the integration between Camel, Dropwizard Metrics and CDI,</li><li><code>camel-example-cdi -properties</code> - illustrates the integration between Camel, DeltaSpike and CDI for configuration properties,</li><li><code>camel-example-cdi-osgi</code> - a CDI application using the SJMS component that can be executed inside an OSGi container using PAX CDI,</li><li><code>camel-example-cdi-rest-servlet</code> - illustrates the Camel REST DSL being used in a Web application that uses CDI as dependency injection framework,</li><li><code>camel-example-widget-gadget-cdi</code> - the Widget and Gadget use-case from the EIP book implemented in Java with CDI dependency Injection,</li><li><span><span><code>camel-example-swagger-cdi</code> - a</span>n example using REST DSL and Swagger Java with CDI.</span></li></ul><h3 id="CDI-SeeAlso">See Also</h3><ul><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>