cancel
Showing results for 
Search instead for 
Did you mean: 

Camel configuration programatically

rodiaz
Champ in-the-making
Champ in-the-making
Hello there,

I work with Activiti embedded in my own application, which already has a CamelContext. Could Activiti be configured programmatically for to use the context that I already have in my application? I can not use that engine has its own context because I need to integrate more things. Nor do I find the mode if there is to access Activiti CamelContext.

Thank you very much
3 REPLIES 3

trademak
Star Contributor
Star Contributor
Hi,

Yes in the ProcessEngineConfiguration you can use the setDefaultCamelContext method to do that.

Best regards,

rodiaz
Champ in-the-making
Champ in-the-making
Hi again,

I use setDefaultCamelContext but now my problem is another. I get a NullPointerException when I try to start a process from camel.

Caused by: java.lang.NullPointerException
at org.activiti.camel.ActivitiProducer.startProcess(ActivitiProducer.java:93)
at org.activiti.camel.ActivitiProducer.process(ActivitiProducer.java:45)

I can see that this is because runtimeService is null. I have the runtimeService bean in my  activiti.cfg.xml and I have tried to put it in the register of my camelContext in this way

myOwnCamelContext.setRegistry(new ApplicationContextRegistry(new org.springframework.context.support.ClassPathXmlApplicationContext("activiti/test/activiti.cfg.xml")));

But it does not work and runtimeService continue being null.

smirzai
Champ on-the-rise
Champ on-the-rise
Camel Component uses spring context. You should initialize it using spring.