Uploaded image for project: 'Spring AMQP'
  1. Spring AMQP
  2. AMQP-718

ChannelProxy Wrapper Should Not Refresh During Transaction

    XMLWordPrintable

Details

    Description

      Consider the following test case

      @Test
      public void testTx() throws Exception {
      	Channel channel = this.connectionFactory.createConnection().createChannel(true);
      	RabbitResourceHolder holder = new RabbitResourceHolder(channel, true);
      	TransactionSynchronizationManager.bindResource(this.connectionFactory, holder);
      	this.template.setChannelTransacted(true);
      	this.template.convertAndSend(ROUTE, "foo");
      	this.template.convertAndSend("junk", ROUTE, "xxx");
      	this.template.convertAndSend(ROUTE, "bar");
      	channel.txCommit();
      }
      

      The underlying channel is closed on the second send (invalid exchange). The third send refreshes the proxy.

      It is not clear why, but nothing is committed (I would expect the bar message to commit). However, we should get an exception on the third send since the transaction is broken.

      Add code to the proxy to detect if a transaction is in process before refreshing the channel.

      Attachments

        Activity

          People

            grussell Gary Russell
            grussell Gary Russell
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: