camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magnus Heino" <mag...@filur.org>
Subject Bug?
Date Fri, 08 Feb 2008 08:42:50 GMT
Hi.

I have XA transactions working now... but only using "pure" spring, not
camel.

My code looks like this now:

@Component("updateService")
public class UpdateServiceImpl implements UpdateService {

    @EndpointInject(uri = "jms:queue:foobar")
    private ProducerTemplate producer;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    /*
     * (non-Javadoc)
     *
     * @see
se.lantmateriet.origo.service.internal.UpdateService#handleMessage(
java.lang.String)
     */
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void handleMessage(final String message) {
        this.logger.info("Message received: '{}'", message);
    }

    /*
     * This is triggered by a timer...
     */
    public void send() {
        this.logger.debug("Sending Jms message");
        this.producer.sendBody("demo");
    }
}



this:

    <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>

Makes my bean consume messages in a xa transaction. Pending message count in
EMS is 0 when the queue is empty and the app is running, and it stays that
way when I shutdown jboss.

This config, which really does exactly the same thing afaik, fails:

<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>

    <camel:camelContext>
        <camel:route>
            <camel:from uri="jms:queue:foobar" />
            <camel:to uri="bean:updateService" />
        </camel:route>
    </camel:camelContext>

Pending message count in EMS is 0 when the queue is empty and the app is
running, but when I shutdown jboss all messages that have been consumed are
back in ems, pending message size >0.

>From my non-expert view, it looks as if mssages are left unacknowledged in
EMS queue after camel has committed the transaction...?

-- 

 /Magnus Heino

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message