Iam using jboss fuse63 on eap6.4, to make camel context defined with spring DSL run after deploying the camel app as war, I have to use a listener class in web.xml, and use the listener class to start camel context as the following:
ApplicationContext contextCommon = new FileSystemXmlApplicationContext("camel-context-common.xml");
DefaultCamelContext camelContextCommon = (DefaultCamelContext)contextCommon.getBean("_camelContext_common");
try {
camelContextCommon.start();
...
The abstract of my spring DSL is as the following(autoStartup="true" is defined):
<beans ...">
<bean class="test.CommonProcessor" id="commProcessor"/>
<camelContext autoStartup="true" id="_camelContext_common"
shutdownRunningTask="CompleteAllTasks" xmlns="http://camel.apache.org/schema/spring">
Is there a way to make camel context run automatically on eap without using java code to start it?
Best regards
Yes, there is easy way. You have to correctly name your Spring XML file which contains Camel route. The file naming convention requires to include the -camel-context.xml
suffix.
In your case, rename camel-context-common.xml
file to common-camel-context.xml
. If you do that then Camel subsystem will automatically start up camel contexts.