<div>Hi,</div><div> I'm faced a weird case, </div><div><br></div><div>I started using transacted channels. I had set my channels with channel.txSelect();</div><div><br></div><div>In the consumer that I defined (please see code below) , whenever my code reaches the point where this.getChannel().txCommit() the thread just hangs and doesn't move forward. I'm using a rabbit server and client (java) of 2.6.1 version. </div>
<div><br></div><div>Any help will be great. </div><div><br></div><div>Thank you,</div><div>Praveen </div><div><br></div><div><br></div><div><br></div><div>import java.io.IOException;</div><div><br></div><div>import com.rabbitmq.client.*;</div>
<div><br></div><div>public class SmartQConsumer extends DefaultConsumer {</div><div><br></div><div> RabbitMqHandler rabbitHandler;</div><div><br></div><div> public SmartQConsumer(Channel channel, RabbitMqHandler rabbitHandler) {</div>
<div> super(channel);</div><div> this.rabbitHandler = rabbitHandler;</div><div> }</div><div><br></div><div> @Override</div><div> public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) {</div>
<div> try { </div><div> rabbitHandler.onMessage(1000, body);</div><div> this.getChannel().basicAck(envelope.getDeliveryTag(), false);</div><div> this.getChannel().txCommit(); <b>//hangs/blocks here</b></div>
<div> } catch (Exception x) {</div><div> try {</div><div> this.getChannel().txRollback();</div><div> } catch (IOException x1) {</div><div> x1.printStackTrace();</div><div> }</div>
<div><br></div><div> x.printStackTrace();</div><div> }</div><div> }</div><div><br></div><div>}</div><div><br></div>-- <br>-Praveen<br>