You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/01/10 13:23:41 UTC
[camel] 01/04: Polished
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit f474c5f0fc51199309466ee0696d4ec5323eb5f0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jan 10 14:03:06 2022 +0100
Polished
---
components/camel-cdi/src/main/docs/cdi.adoc | 48 ++++++++++++-----------------
1 file changed, 20 insertions(+), 28 deletions(-)
diff --git a/components/camel-cdi/src/main/docs/cdi.adoc b/components/camel-cdi/src/main/docs/cdi.adoc
index 4026403..5f9c937 100644
--- a/components/camel-cdi/src/main/docs/cdi.adoc
+++ b/components/camel-cdi/src/main/docs/cdi.adoc
@@ -44,7 +44,6 @@ type `DefaultCamelContext`.
Note that this bean can be customized programmatically and other Camel
context beans can be deployed in the application as well.
-[[CDI-Auto-detectingCamelroutes]]
== Auto-detecting Camel routes
Camel CDI automatically collects all the `RoutesBuilder` beans in the
@@ -115,7 +114,7 @@ TypeConverter converter;
== Camel context configuration
If you just want to change the name of the default `CamelContext` bean,
-you can used the `@Named` qualifier provided by CDI, e.g.:
+you can use the `@Named` qualifier provided by CDI, e.g.:
[source,java]
----
@@ -151,8 +150,8 @@ class CustomCamelContext extends DefaultCamelContext {
}
----
-http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#producer_method[Producer]
-and http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#disposer_method[disposer]
+http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#producer_method[Producer]
+and http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#disposer_method[disposer]
methods can also be used as well to customize the Camel context bean, e.g.:
[source,java]
@@ -173,7 +172,7 @@ class CamelContextFactory {
}
----
-Similarly, http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#producer_field[producer
+Similarly, http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#producer_field[producer
fields] can be used, e.g.:
[source,java]
@@ -253,10 +252,6 @@ static class DeltaSpikeParser extends DefaultPropertiesParser {
}
----
-You can see the `camel-example-cdi-properties` example for a working
-example of a Camel CDI application using DeltaSpike configuration
-mechanism.
-
== Auto-configured type converters
CDI beans annotated with the `@Converter` annotation are automatically
@@ -287,7 +282,7 @@ are seamlessly supported by Camel CDI. So you can use any of these
annotations in your CDI beans, e.g.:
[width="100%",cols="1,2a,2a",options="header",]
-|===
+|==============================================
| |Camel annotation |CDI equivalent
|Configuration property a|
[source,java]
@@ -316,7 +311,6 @@ See configuration properties for more details.
@Produce("mock:outbound")
ProducerTemplate producer;
-// or using fluent template
@Produce("mock:outbound")
FluentProducerTemplate producer;
----
@@ -328,12 +322,11 @@ FluentProducerTemplate producer;
@Uri("direct:outbound")
ProducerTemplate producer;
-// or using fluent template
@Produce("direct:outbound")
FluentProducerTemplate producer;
----
-|Endpoint injection (default Camel context) a|
+|Endpoint injection a|
[source,java]
----
@EndpointInject("direct:inbound")
@@ -348,12 +341,6 @@ Endpoint endpoint;
Endpoint endpoint;
----
-----
-@Inject
-@Uri("direct:inbound")
-Endpoint contextEndpoint;
-----
-
|Bean injection (by type) a|
[source,java]
----
@@ -392,8 +379,7 @@ void consume(@Body String body) {
}
----
- |
-|===
+|==============================================
=== Bean component
@@ -500,7 +486,7 @@ detected in the deployment, and that per Camel context.
== CDI events endpoint
The CDI event endpoint bridges
-the http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#events[CDI
+the http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#events[CDI
events] with the Camel routes so that CDI events can be seamlessly
observed / consumed (resp. produced / fired) from Camel consumers (resp.
by Camel producers).
@@ -588,10 +574,10 @@ void observeCdiEvents(@Observes @FooQualifier List<String> event) {
----
Note that the CDI event Camel endpoint dynamically adds
-an http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#observer_methods[observer
+an http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#observer_methods[observer
method] for each unique combination of _event type_ and _event
qualifiers_ and solely relies on the container
-typesafe http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#observer_resolution[observer
+typesafe http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#observer_resolution[observer
resolution], which leads to an implementation as efficient as possible.
Besides, as the impedance between the _typesafe_ nature of CDI and
@@ -720,9 +706,15 @@ You'll have to have your application deployed in a JTA capable container or prov
[CAUTION]
====
-Note that, for the time being, the transaction manager is looked up as JNDI resource with the `java:/TransactionManager` key.
-More flexible strategies will be added in the future to support a wider range of deployment scenarios.
+Note that, for the time being, the transaction manager is looked up as JNDI resource with the following keys:
+
+----
+java:comp/TransactionManager
+java:appserver/TransactionManager
+java:pm/TransactionManager
+java:/TransactionManager
+----
====
=== Transaction policies
@@ -800,10 +792,10 @@ class MyRouteBean extends CdiRouteBuilder {
== Lazy Injection / Programmatic Lookup
-While the CDI programmatic model favors a http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#typesafe_resolution[typesafe resolution]
+While the CDI programmatic model favors a http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#typesafe_resolution[typesafe resolution]
mechanism that occurs at application initialization time, it is possible to perform
dynamic / lazy injection later during the application execution using the
-http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#programmatic_lookup[programmatic lookup]
+http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#programmatic_lookup[programmatic lookup]
mechanism.
Camel CDI provides for convenience the annotation literals corresponding to the