Results 1 to 8 of 8

Thread: Some problem about transaction

  1. #1
    Join Date
    Jul 2012
    Posts
    18

    Default Some problem about transaction

    when I set true to channelTransacted ,the application cannot send ack automatically.Though , I have process these messages ,the server still show the messages sended through the channel are unAck .So What is the problem?

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,142

    Default

    Are you using the current release? (1.1.2).

    Please show your configuration.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Jul 2012
    Posts
    18

    Default

    This is my configuration,and I am using 1.1.1 release
    Code:
           <bean id="rabbitTransactionManager"
    		class="org.springframework.amqp.rabbit.transaction.RabbitTransactionManager">
    		<property name="connectionFactory" ref="rabbitConnectionFactory" />
    	</bean>
    
    	<rabbit:listener-container id="ocrWorker"
    		concurrency="20" connection-factory="rabbitConnectionFactory" prefetch="20"
    		transaction-size="5" auto-startup="false" message-converter="orcMessageConvert">
    		<rabbit:listener method="doMessageQueueWork"
    			queue-names="#{sendOcrRequestQueue}" ref="ocrListener" transaction-manager="rabbitTransactionManager" />
    	</rabbit:listener-container>
    and as soon as the application start, my a service will execute ocrWorker.setChannelTransacted(true),the ocrWorker is the container Listener
    Last edited by Gary Russell; Oct 25th, 2012 at 08:29 AM.

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,142

    Default

    Please use [ code ] ... [ /code ] tags when posting code/config (no spaces inside brackets - I have edited your post).

    It's too late to set it after the container has started.

    The 'channel-transacted' attribute was added to the listener containe in 1.1.2; there were also some other fixes related to transactions.

    Please upgrade to 1.1.2 and let us know if you are still having problems.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  5. #5
    Join Date
    Jul 2012
    Posts
    18

    Default

    I have set the container not automatically start up , you can find that the auto-startup's value in the configuration is false.My service will execute ocrWorker.setChannelTransacted(true) first ,then start up the container. What your meaning is that the problem may be is a bug in 1.1.1 release? I guess that the ack model may be changed and I need to commit and send ack by myself instead of sending automatically,but how could I do to commit or send ack by myself ? thanks

  6. #6
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,142

    Default

    Please use 1.1.2 and let us know if you still have a problem.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  7. #7
    Join Date
    Jul 2012
    Posts
    18

    Default

    I have used the 1.1.2 released and there is no these problem,but I also have a problem that in the testing of transaction , some of messages can always occur a exception ,but at last these failure messages can not be found in queue, what is the problem ? I surmise that StatefulRetryOperationsInterceptor try some times to execute the message,if it can not execute successfully after many times ,it will send ack to queue?

  8. #8
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,142

    Default

    As stated in the documentation...

    http://static.springsource.org/sprin...qp.html#d4e476

    ...(last paragraph) the default recoverer simply logs a WARN message when the retries are exhausted (default maxAttempts=3); this causes the message to be acked.

    You can either write a custom MessageRecoverer and send the bad message someplace else, or you can use the RejectAndDontRequeueRecoverer in conjunction with a Dead Letter Exchange to send the bad message to a Dead Letter Queue.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •