camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Bug?
Date Fri, 08 Feb 2008 12:29:22 GMT
On 08/02/2008, Magnus Heino <magnus@filur.org> wrote:
> >
> >
> >
> > Are you totally positive you are using exactly the same transaction
> > manager and JMS connection factory in both cases?
>
>
> Yes, 101%.
>
> This is my applicationContext.xml
>
> I run it as it is right now, and it fails. Messages are back in ems when I
> shutdown jboss.
>
> I then uncomment the empty camelcontext and DefaultMessageListenerContainer,
> comment out the camelcontext with the route and JmsComponent, clean build
> and redeploy, start jboss, consume a few messages, shutdown, no messages are
> now in ems.
>
> I can do this over and over again, the only change is in this file, and the
> behaviour is the same all the time.
>
> This is 1.2.0, same thing happens with 1.3-SNAPSHOT.
>
> I have eclipse setup with sourcecode, so it's easy for me to debug. And tip
> on where I should look?
>
>    <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="
> http://www.springframework.org/schema/tx"
>     xmlns:util="http://www.springframework.org/schema/util" xmlns:jee="
> http://www.springframework.org/schema/jee"
>     xmlns:context="http://www.springframework.org/schema/context"
> xmlns:camel="http://activemq.apache.org/camel/schema/spring"
>     xsi:schemaLocation="http://www.springframework.org/schema/beans
>        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>        http://www.springframework.org/schema/aop
>        http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>        http://www.springframework.org/schema/tx
>        http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
>        http://www.springframework.org/schema/util
>        http://www.springframework.org/schema/util/spring-util-2.5.xsd
>        http://www.springframework.org/schema/jee
>        http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
>        http://www.springframework.org/schema/context
>        http://www.springframework.org/schema/context/spring-context-2.5.xsd
>        http://activemq.apache.org/camel/schema/spring
>        http://activemq.apache.org/camel/schema/spring/camel-spring-1.2.0.xsd
> "
>     default-autowire="no">
>
>     <context:component-scan base-package="se.lantmateriet.origo" />
>
>     <tx:annotation-driven />
>
>     <tx:jta-transaction-manager />
>
>     <jee:jndi-lookup id="jmsConnectionFactory"
> jndi-name="java:jms/jmsConnectionFactory" />
>
> <!--
>     <camel:camelContext />
>
>     <bean id="updateServiceListenerContainer" class="
> org.springframework.jms.listener.DefaultMessageListenerContainer">
>         <property name="concurrentConsumers" value="1" />
>         <property name="connectionFactory" ref="jmsConnectionFactory" />
>         <property name="transactionManager" ref="transactionManager" />
>         <property name="sessionTransacted" value="true" />
>         <property name="destinationName" value="foobar" />
>         <property name="messageListener">
>             <bean class="
> org.springframework.jms.listener.adapter.MessageListenerAdapter">
>                 <constructor-arg ref="updateService" />
>             </bean>
>         </property>
>     </bean>
>  -->
>     <camel:camelContext>
>         <camel:route>
>             <camel:from uri="jms:queue:foobar" />
>             <camel:to uri="bean:updateService" />
>         </camel:route>
>     </camel:camelContext>
>
>     <bean class="org.apache.camel.component.jms.JmsComponent">
>         <property name="concurrentConsumers" value="1" />
>         <property name="connectionFactory" ref="jmsConnectionFactory" />
>         <property name="transactionManager" ref="transactionManager" />
>         <property name="transacted" value="true" />
>     </bean>
>
>     <bean id="scheduledTask" class="
> org.springframework.scheduling.timer.ScheduledTimerTask">
>         <!-- wait 5 seconds before starting repeated execution -->
>         <property name="delay" value="5000" />
>         <!-- run every 5 seconds -->
>         <property name="period" value="5000" />
>         <property name="timerTask">
>             <bean id="doIt" class="
> org.springframework.scheduling.timer.MethodInvokingTimerTaskFactoryBean">
>                 <property name="targetObject" ref="updateService" />
>                 <property name="targetMethod" value="send" />
>             </bean>
>         </property>
>     </bean>
>
>     <bean id="timerFactory" class="
> org.springframework.scheduling.timer.TimerFactoryBean">
>         <property name="scheduledTimerTasks">
>             <list>
>                 <!-- see the example above -->
>                 <ref bean="scheduledTask" />
>             </list>
>         </property>
>     </bean>
>
> </beans>

Damn :)

If you don't mind helping debug it (which would be awesome BTW!), I
guess you could set a breakpoint in the
JmsConfiguration.createMessageListenerContainer() and see what
MessageListenerContainer is created by Camel and how its configured -
to see if there's any real difference at all in how Camel configures
it to how you've configured it explicitly? That must be the problem I
guess?

All the JmsConsumer does in Camel is create the
MessageListenerContainer, set the MessageListener on it to process the
message via Camel then start the container and Spring does the rest.

BTW do the JMS messages on the queue have the JMSReplyTo header set?
Only if it has then Camel by default will try and send a reply back
(am just wondering if this might have an effect). You can disable it
via the "disableReplyTo" property on the endpoint URI

http://cwiki.apache.org/CAMEL/jms.html

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message