<div dir="ltr">I'm an optimistic person, so I just had to try 3.1.4. But... you are right. It does not work there either.<div><br></div><div>The good news is that I've updated the handleCancel method to consume from a new thread (as you suggested) and that seems to work! Is this essentially what you had in mind?</div>
<div><font face="courier new, monospace"><br></font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="courier new, monospace"> @Override</font></div></div><div><div><font face="courier new, monospace"> public void handleCancel(String consumerTag) throws IOException {</font></div>
</div><div><div><font face="courier new, monospace"> System.out.println("handleCancel: " + consumerTag);</font></div></div><div><div><font face="courier new, monospace"> super.handleCancel(consumerTag);</font></div>
</div><div><div><font face="courier new, monospace"><br></font></div></div><div><div><font face="courier new, monospace"> final SimpleConsumer self = this;</font></div></div><div><div><font face="courier new, monospace"> Runnable reconsumeTask = new Runnable() {</font></div>
</div><div><div><font face="courier new, monospace"> @Override</font></div></div><div><div><font face="courier new, monospace"> public void run() {</font></div></div><div><div><font face="courier new, monospace"> try {</font></div>
</div><div><div><font face="courier new, monospace"> String cTag = getChannel().basicConsume(queue, self);</font></div></div><div><div><font face="courier new, monospace"> System.out.println("basic(Re)Consume: " + cTag);</font></div>
</div><div><div><font face="courier new, monospace"> } catch (IOException e) {</font></div></div><div><div><font face="courier new, monospace"> System.err.println("basic(Re)Consume FAILED");</font></div>
</div><div><div><font face="courier new, monospace"> e.printStackTrace();</font></div></div><div><div><font face="courier new, monospace"> }</font></div></div><div><div><font face="courier new, monospace"> }</font></div>
</div><div><div><font face="courier new, monospace"> };</font></div></div><div><div><font face="courier new, monospace"> new Thread(reconsumeTask).start();</font></div></div><div><div><font face="courier new, monospace"> }</font></div>
</div></blockquote><div><br></div><div>If I recall, it's generally recommended that you not use the same channel in multiple threads-- but I guess this is an exception to the rule?</div><div><br></div><div>Thanks again for the help!</div>
<div>Chris</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 9, 2013 at 9:41 AM, Michael Klishin <span dir="ltr"><<a href="mailto:mklishin@gopivotal.com" target="_blank">mklishin@gopivotal.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Michael Klishin:<br>
<div class="im"><br>
> This looks like a bug in the Java client.<br>
<br>
</div>Using basicConsume from another (e.g. newly created) thread is how you can work<br>
around this issue. Passing this for consumer reference instead of instantiating a new<br>
consumer should work fine.<br>
--<br>
MK<br>
<br>
<br>_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br></blockquote></div><br></div>