Hello,

in Your code there is:

<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="" />
</bean>

Shouldn't brokerURL be set to the value used by broker (e.g.
tcp://localhost:61616)?

br, 
maciek


On Thu, 10 Sep 2009 09:23:26 -0700 (PDT), Gareth Williams
<[email protected]> wrote:
> Thanks, I just tried
> 
>     <bean id="route"
> class="test.com.firstclarity.eventbroker.MyTestRoutes"/>
>     
>   <camelContext xmlns="http://camel.apache.org/schema/spring";>
>     <!-- Where to look for implementations of RouteBuilder -->
>     <!-- <package>test.com.firstclarity.eventbroker</package>
>      -->
>      
>     <routeBuilder ref="route"/>
> 
>   </camelContext>
> 
> unfortunately same thing, no messages,
> 
> FYI, i currently have activemq running as a separate process to my test
> case, its just the default out-of-the-box installation, started with
> ./activemq
> 
> is there a good working example of activemq + camel you would recommend
so
> i
> can look at this in more depth?
> 
> thanks, Gareth
> 
> PS. have spooted the deliverate mistake in my test,
> assertTrue("FAIL: NO MESSAGE RECEIVED", eventListener.messagesReceived ==
> 1); 
> should be 
> assertTrue("FAIL: NO MESSAGE RECEIVED", eventListener.messagesReceived >
> 0);
> but none are getting through anyway
> 
>  
> 
> Claus Ibsen-2 wrote:
>> 
>> Try using <routeBuilderRef> and refer to a spring bean that is your
>> route builder.
>> 
>> The <packageScan> may have problems on your side, somehow.
>> 
>> 
>> 
>> On Thu, Sep 10, 2009 at 5:47 PM, Gareth Williams
>> <[email protected]> wrote:
>>>
>>> Hi all
>>> I have just started learning camel and JMS and ActiveMQ, and i am stuck
>>> trying to get camel to read messages off ActiveMQ
>>>
>>> which version of the software?
>>> camel version 2.0.0
>>>
>>> what platform and JDK?
>>> os x 10.5.8 JDK 1.5.x
>>>
>>> If i connect to ActiveMQ using jconsole, i can see there are 2000+
>>> messages
>>> there in a queue called MUPPET.QUEUE
>>>
>>> Below is my Java JUnit code, the routebuilder, the spring context xml
>>> and
>>> part of the pom.
>>> What the junit test  does is send a http request to login a user, that
>>> causes my actual application to post a JMS message to MUPPET.QUEUE (yes
>>> i
>>> do
>>> see the queue growing!)
>>> What I was hoping for is Camel to receive the messages off the queue
and
>>> route them to my bean eventbroker which i have already tested with
Camel
>>> in
>>> a non-JMS way by using
>>>   �...@produce(uri = "direct:start")
>>>    protected ProducerTemplate template;
>>> which worked fine and allowed me to learn routing, endpoints, etc
>>>
>>> My eventbroker bean isnt receiving anything!  OK I daresay I am missing
>>> something fundamental about JMS and/or activemq/camel configuration,
but
>>> I
>>> am stumped...
>>> Do i need to declare a connection factory in my spring xml? or is the
>>> information i have given camel sufficient for it to start taking
>>> messages
>>> off the queue?
>>> All help gratefully accepted!  Any ideas?
>>>
>>> Cheers,
>>> Gareth
>>>
>>>
>>> @ContextConfiguration
>>> public class MyTest extends AbstractJUnit4SpringContextTests {
>>>
>>> ...
>>> ....
>>>
>>>    private static class MyListener implements EventListener {
>>>
>>>        private int messagesReceived;
>>>
>>>        public void notify(String target, Event event) {
>>>            System.out.println("***");
>>>            messagesReceived++;
>>>        }
>>>    }
>>>
>>>
>>>   �...@test
>>>    public void testJms() throws Exception {
>>>
>>>        System.out.println("START TEST");
>>>       SimpleEventBroker eventbroker = (SimpleEventBroker)
>>> applicationContext.getBean("eventbroker");
>>>        MyListener eventListener = new MyListener();
>>>        eventbroker.getListeners().add(eventListener);
>>>
>>>        System.out.println("LOGIN...");
>>>        for (int i = 0; i < 10; i++) {
>>>            loginValidUser();
>>>        }
>>>        System.out.println("OK LOGGED IN");
>>>        pause(2);
>>>        assertTrue("FAIL: NO MESSAGE RECEIVED",
>>> eventListener.messagesReceived == 1);
>>>    }
>>> }
>>>
>>> My route builder...
>>>
>>> public class MyTestRoutes extends RouteBuilder {
>>>
>>>   �...@override
>>>    public void configure() {
>>>
>>>
>>>
from("activemq:MUPPET.QUEUE").to("bean:eventbroker?method=writeToFile");
>>>
>>>    }
>>> }
>>>
>>> MyTest-context.xml (spring context config)...
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>>
>>> <!-- Configures the Camel Context-->
>>>
>>> <beans xmlns="http://www.springframework.org/schema/beans";
>>>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>>       xmlns:amq="http://activemq.apache.org/schema/core";
>>>       xsi:schemaLocation="http://www.springframework.org/schema/beans
>>>          
>>>  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>>            http://camel.apache.org/schema/spring
>>> http://camel.apache.org/schema/spring/camel-spring.xsd
>>>            http://activemq.apache.org/schema/core
>>> http://activemq.apache.org/schema/core/activemq-core.xsd";>
>>>
>>> <bean id="activemq"
>>> class="org.apache.activemq.camel.component.ActiveMQComponent">
>>>    <property name="brokerURL" value="tcp://localhost:61616" />
>>>
>>> </bean>
>>>
>>>
>>>    <bean id="eventbroker"
>>> class="test.com.firstclarity.eventbroker.SimpleEventBroker"/>
>>>
>>>  <camelContext xmlns="http://camel.apache.org/schema/spring";>
>>>    <package>test.com.firstclarity.eventbroker</package>
>>>  </camelContext>
>>>
>>> </beans>
>>>
>>>
>>> My maven pom
>>>
>>> <project>
>>>
>>> ...
>>>
>>>  <properties>
>>>    <camel-version>2.0.0</camel-version>
>>>    <activemq-version>5.2.0</activemq-version>
>>>    <xbean-spring-version>3.5</xbean-spring-version>
>>>    <log4j-version>1.2.14</log4j-version>
>>>  </properties>
>>>
>>>  <dependencies>
>>>
>>> ...
>>> ...
>>>
>>>        <dependency>
>>>      <groupId>org.springframework</groupId>
>>>      <artifactId>spring-test</artifactId>
>>>      <version>2.5.6</version>
>>>      <scope>test</scope>
>>>    </dependency>
>>>
>>>        <dependency>
>>>      <groupId>org.springframework</groupId>
>>>      <artifactId>spring-context</artifactId>
>>>      <version>2.5.6</version>
>>>    </dependency>
>>>
>>>            <dependency>
>>>            <groupId>opensymphony</groupId>
>>>            <artifactId>quartz-all</artifactId>
>>>            <version>1.6.3</version>
>>>        </dependency>
>>>
>>>    <dependency>
>>>      <groupId>org.apache.activemq</groupId>
>>>      <artifactId>activemq-core</artifactId>
>>>      <version>${activemq-version}</version>
>>>    </dependency>
>>>    <dependency>
>>>      <groupId>org.apache.activemq</groupId>
>>>      <artifactId>activemq-camel</artifactId>
>>>      <version>${activemq-version}</version>
>>>    </dependency>
>>>    <dependency>
>>>      <groupId>org.apache.camel</groupId>
>>>      <artifactId>camel-core</artifactId>
>>>      <version>${camel-version}</version>
>>>    </dependency>
>>>
>>>        <dependency>
>>>      <groupId>org.apache.camel</groupId>
>>>      <artifactId>camel-stream</artifactId>
>>>      <version>${camel-version}</version>
>>>    </dependency>
>>>
>>>    <dependency>
>>>      <groupId>org.apache.camel</groupId>
>>>      <artifactId>camel-jms</artifactId>
>>>      <version>${camel-version}</version>
>>>    </dependency>
>>>    <dependency>
>>>      <groupId>org.apache.camel</groupId>
>>>      <artifactId>camel-spring</artifactId>
>>>      <version>${camel-version}</version>
>>>    </dependency>
>>>    <dependency>
>>>      <groupId>org.apache.xbean</groupId>
>>>      <artifactId>xbean-spring</artifactId>
>>>      <version>${xbean-spring-version}</version>
>>>    </dependency>
>>>
>>>   ...
>>>   ...
>>>
>>>   </dependencies>
>>>  ...
>>>  </project>
>>>
>>> --
>>> View this message in context:
>>>
http://www.nabble.com/newbie-trying-to-get-messages-off-activemq-and-route-them-using-camel-tp25385346p25385346.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Claus Ibsen
>> Apache Camel Committer
>> 
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>> 
>>

Reply via email to