[rabbitmq-discuss] channel.basicCancel hangs
Kristian Lind
klindp at gmail.com
Wed May 22 00:52:45 BST 2013
Updated to amqp-client 3.1.0 but still same problem.
Tried to close channel instead od basicCancel.. same problem.
On Tuesday, May 21, 2013 4:02:59 PM UTC-7, Kristian Lind wrote:
>
> <dependency>
> <groupId>com.rabbitmq</groupId>
> <artifactId>amqp-client</artifactId>
> <version>3.0.4</version>
> </dependency>
>
> RabbitMQ 3.0.2, Erlang R16A
>
> I have a webpage that has a start button and a stop button.
> These to buttons should start and stop the consuming messages.
>
> When the user presses start button the consuming starts... when the user
> presses the stop button the consuming stops
> BUT.. the user cannot start the consuming again.
> While debugging the code, I see the method call channel.basicCancel
> hangs... and the debugger stops...
> When I stop the JBoss server where the application is deployd I see this
> exception coming in the catch when doing channel.basicCancel.
> com.rabbitmq.client.ShutdownSignalException: clean channel shutdown;
> reason: #method<channel.close>(reply-code=200, reply-text=OK, class-id=0,
> method-id=0)
>
> And in the method handleDelivery I see ShutdownSignalException...
> com.rabbitmq.client.AlreadyClosedException: clean connection shutdown;
> reason: Attempt to use closed channel
>
> The call to basicCancel only hangs when consuming is going on.. if I
> start the consuming, but no messages are on the queue, I can stop it.. and
> start it again.
>
> @Override
> protected final synchronized void service(final HttpServletRequest req,
> final HttpServletResponse resp) throws ServletException, IOException {
> String task = req.getParameter("task");
> ...
> if (StringUtils.isNotBlank(task) && task.equals("stop")) {
> consuming = false;
> try {
> channel.basicCancel("MonitorConsumer");
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> } else {
> if (connection == null || channel == null) {
> createRabbitConnection();
> }
> if (!consuming) {
> channel.basicConsume(Configuration.QUEUE_JSI_TO_DASHBOARD, false,
> "MonitorConsumer", this);
> consuming = true;
> }
> }
> }
>
> public synchronized void handleDelivery(String consumerTag, Envelope
> envelope, BasicProperties properties, byte[] body) throws IOException {
> ...
> try {
> channel.basicAck(deliveryTag, false);
> } catch (ShutdownSignalException e) {
> e.printStackTrace();
> }
> }
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130521/35fa6643/attachment.htm>
More information about the rabbitmq-discuss
mailing list