According to http://camel.apache.org/cdi.html
@Inject
@Uri("direct:event")
ProducerTemplate producer;
void observeCdiEvents(@Observes String event) {
producer.sendBody(event);
}
from("direct:event")
.log("CDI event received: ${body}");
is equivalent to
@Inject
CdiEventEndpoint<String> cdiEventEndpoint;
from(cdiEventEndpoint).log("CDI event received: ${body}");
How do I convert the example with
producer.asyncSendBody(...)
to use CdiEventEndpoint . Thanks in advance!
I never actually tested this, but from the docs you should be able to replace "direct" with "seda" to go for asych:
@Inject
@Uri("seda:event")
ProducerTemplate producer;
...
After your clarification, I think you might be looking for the asynchronous routing engine in camel, which would be used by inserting threads() into the java dsl setup:
from("direct:event") // using a producer "direct:event" in an @Observes method
.threads()
.log("...")
or regarding the cdi event setup
from(cdiEventEndpoint) // using @Inject CdiEventEndpoint<String> cdiEventEndpoint
.threads()
.log("...")