Hi.

I am new to camel and I'm trying to set up a POJO producer for an activemq
component, following the instructions here:

http://camel.apache.org/pojo-producing.html

I'm using camel via servicemix 4.5.3 (camel 2.10.7) and am using the
embedded activemq broker (ActiveMQ 5.7.0).

I have an interface defined as:

public interface MyListener {
    String sayHello(String name);
}

and a simple POJO producer:

public class MyBean {
    @Produce(uri = "activemq:foo")
    protected MyListener producer;
 
    public void doSomething() {
        // lets send a message
        String response = producer.sayHello("James");
    }
}

My problem is that my producer is null and throws an NPE at
producer.sayHello(...

I guess I'm missing something in wiring this all together.

I've configured a pooled connection factory and activemq component via the
instructions here:

http://camel.apache.org/activemq.html#ActiveMQ-Usingconnectionpooling

as such (note, I'm using blueprint config instead of spring):

        <camelContext
xmlns="http://camel.apache.org/schema/blueprint";></camelContext>
        
        <bean id="jmsConnectionFactory"
          class="org.apache.activemq.ActiveMQConnectionFactory">
            <property name="brokerURL" value="tcp://localhost:61616" />
        </bean>

        <bean id="pooledConnectionFactory"
          class="org.apache.activemq.pool.PooledConnectionFactory"
init-method="start" destroy-method="stop">
            <property name="maxConnections" value="8" />
            <property name="connectionFactory" ref="jmsConnectionFactory" />
        </bean>

        <bean id="jmsConfig"
          class="org.apache.camel.component.jms.JmsConfiguration">
            <property name="connectionFactory" ref="pooledConnectionFactory"/>
            <property name="concurrentConsumers" value="10"/>
        </bean>

        <bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
            <property name="configuration" ref="jmsConfig"/>
        </bean>

Thanks for any help,
Michael



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-activemq-POJO-producer-is-null-tp5746075.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to