You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Ayelet <ay...@netomedia.com> on 2014/01/13 16:07:10 UTC

Spring JMS topics durable subscriptions

Hi,

We're trying to set up ActiveMQ 5.9.0 as a message broker using JMS topics,
but we're having some issues with the consumption of the messages.

For testing purposes, we have a simple configuration of 1 topic, 1 event
producer, and 1 consumer. We send 10 messages one after the other, but every
time we run the application, 1-3 of these messages are not consumed! The
other messages are consumed and processed fine.
Apparently, the solution is to define durable topics, but we couldn't find a
comprehensive example of how to do that in the spring xmls.
This is our current configuration:

 <bean id="connectionFactory"
class="com.atomikos.jms.AtomikosConnectionFactoryBean"
    init-method="init" destroy-method="close">
    <property name="uniqueResourceName" value="amq" />
    <property name="xaConnectionFactory">
        <bean class="org.apache.activemq.spring.ActiveMQXAConnectionFactory"
            p:brokerURL="${activemq_url}" />
    </property>
    <property name="maxPoolSize" value="10" />
    <property name="localTransactionMode" value="false" />
</bean>

<bean id="cachedConnectionFactory"
    class="org.springframework.jms.connection.CachingConnectionFactory">
    <property name="targetConnectionFactory" ref="connectionFactory" />
</bean>


<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="cachedConnectionFactory" />
    <property name="sessionTransacted" value="true" />
    <property name="pubSubDomain" value="true"/>
</bean>

<bean id="testTopic" class="org.apache.activemq.command.ActiveMQTopic">
    <constructor-arg value="test.topic" />
</bean>


<jms:listener-container destination-type="topic"
    connection-factory="connectionFactory"
transaction-manager="transactionManager"
    acknowledge="transacted" concurrency="1">
    <jms:listener destination="test.topic" ref="testReceiver"
        method="receive" />
</jms:listener-container>

Can anyone please help and provide an example/tutorial?
Thanks! :)





--
View this message in context: http://activemq.2283324.n4.nabble.com/Spring-JMS-topics-durable-subscriptions-tp4676235.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.