Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Bean component

You can refer to CDI beanbeans, either by type or name, From the Camel DSL, e.g. with the Java Camel DSL:

...

Code Block
languagejava
@Named("foo")
class MyBean {
	//...
}
 
from("direct:inbound").bean("foo");

Referring beans from Endpoint URIs

When configuring endpoints using the URI syntax you can refer to beans in the Registry using the # notation. If the URI parameter value starts with a # sign then Camel CDI will lookup for a bean of the given type by name, e.g.:

Code Block
languagejava
from("jms:queue:{{destination}}?transacted=true&transactionManager=#jtaTransactionManager").to("...");
 
@Produces
@Named("jtaTransactionManager")
PlatformTransactionManager createTransactionManager(TransactionManager transactionManager, UserTransaction userTransaction) {
    JtaTransactionManager jtaTransactionManager = new JtaTransactionManager();
    jtaTransactionManager.setUserTransaction(userTransaction);
    jtaTransactionManager.setTransactionManager(transactionManager);
    jtaTransactionManager.afterPropertiesSet();
    return jtaTransactionManager;
}

Camel events to CDI events

...