-
1. Re: @Produce - producing null pointer
njiang Dec 13, 2009 9:01 PM (in response to rcasazza)Did you register the camel-jms component like this before you started the camel context ?
CamelContext context = new DefaultCamelContext(); ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); context.addComponent("test-jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
-
2. Re: @Produce - producing null pointer
rcasazza Dec 14, 2009 10:09 AM (in response to njiang)I have a separate instance of ActiveMQ running and do the following in main:
CamelContext cc = new DefaultCamelContext();
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
cc.addComponent("activemq", JmsComponent.jmsComponent(connectionFactory));
cc.start();
Then I instantiate the class with the @Produce... and call the method to put a message on the queue.
So I'm not sure what I'm doing wrong. I've played with it some more, but are having no luck. I am using Camel 2.1, JDK 1.6
-
3. Re: @Produce - producing null pointer
davsclaus Dec 14, 2009 12:20 PM (in response to rcasazza)AFAIR you need to use camel-spring which creates those proxies for @Consumer and @Producer.
As you need the IoC container to do it works with among others is the @Consumer stuff as well.
-
4. Re: @Produce - producing null pointer
njiang Dec 15, 2009 8:38 PM (in response to davsclaus)The annotation injection thing is done in BeanPostProcess, you can use this code on your DefaultCamelContext.
CamelBeanPostProcessor processor = new CamelBeanPostProcessor(); processor.setCamelContext(context); // the bean that you want to inject processor.postProcessBeforeInitialization(myBean, "myBean");
-
5. Re: @Produce - producing null pointer
rcasazza Dec 24, 2009 1:01 PM (in response to njiang)That did it.