Batch message sending with JmsTransactionManager of Spring?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Batch message sending with JmsTransactionManager of Spring?

liny
Hi,

I am trying to do transaction with Spring.
Below is my spring configuration:
<beans>

  <bean id="jmsFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL">
      <value>failover:(tcp://xxx:61616,tcp://yyy:61616)?randomize=false&amp;updateURIsSupported=true&amp;maxReconnectAttempts=1&amp;maxReconnectDelay=1000</value>
    </property>
        <!--
        <property name="userName"><value>admin</value></property>
        <property name="password"><value>password</value></property>
        -->
  </bean>

  <bean id="cachingJmsFactory" class="org.springframework.jms.connection.CachingConnectionFactory"
        destroy-method="destroy">
    <property name="targetConnectionFactory">
      <ref local="jmsFactory"/>
    </property>
  </bean>

  <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager" >
    <property name="connectionFactory" ref="cachingJmsFactory"/>
  </bean>

  <bean id="dest" class="org.apache.activemq.command.ActiveMQTopic"
        autowire="constructor" lazy-init="true">
    <constructor-arg value="RTD.NEXT_SETUP" />
  </bean>

  <!-- Spring JMS Template -->
  <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory">
      <ref local="cachingJmsFactory"/>
    </property>
    <property name="sessionTransacted" value="true" />
  </bean>
</beans>

I can send msg with jmsTemplate without transaction, but I don't know how to start a transaction and commit in my program.
Can someone show me sample how to do batch message sending with JmsTransactionManager or other ways?
Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Batch message sending with JmsTransactionManager of Spring?

Sophia Wright
I also want to know.. using spring how can i send a batch of messages and commit after it while using transaction ?

Reply | Threaded
Open this post in threaded view
|

Re: Batch message sending with JmsTransactionManager of Spring?

johnbing
I am beginner in ActiveMQ, I want to use transactions within spring file, But as I saw in org.springframework.jms.core.JmsTemplate

It commit transaction after each message is sent. I want to commit after a batch of messages. How should I configure this ?
Reply | Threaded
Open this post in threaded view
|

Re: Batch message sending with JmsTransactionManager of Spring?

Sophia Wright
In reply to this post by Sophia Wright
Ping !!
Waiting for someone to respond...
Reply | Threaded
Open this post in threaded view
|

Re: Batch message sending with JmsTransactionManager of Spring?

gtully
afaik, spring jmstemplate would need a jta transaction to allow a
batch of sends in a single transaction, but this is really a question
for the spring jms forums.

A plain jms message producer in a transacted session is the simplest
way to achieve what you want.

On 27 November 2013 08:50, Sophia Wright <[hidden email]> wrote:
> Ping !!
> Waiting for someone to respond...
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Batch-message-sending-with-JmsTransactionManager-of-Spring-tp4291842p4674863.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



--
http://redhat.com
http://blog.garytully.com