No subject


Tue Apr 12 10:32:41 BST 2011


AmqpTemplate.receiveAndConvert(queueName) and there no way to cancel
this.

The closest I could get was some dodgy digging into the Spring
AmqpAdmin implementation to grab the channel and make a bad call which
stopped my consumption by throwing
org.springframework.amqp.AmqpIOException.

e.g.

        ((RabbitAdmin)amqpAdmin).getRabbitTemplate().execute(new
ChannelCallback<Object>() {
            @Override
            public Object doInRabbit(Channel channel) throws Exception
{
=20
channel.basicCancel("spring_probably_knows_this_but_i_dont");
                return null;
            }
        });

Thanks,
Dave



On Oct 21, 1:09=A0am, Steve Powell <st... at rabbitmq.com> wrote:
> I cannot tell from where you wish to stop the client.
> I will assume you mean from another Java thread.
>
> To start consuming, you issued basicConsume(...) and either
> supplied a tag (java.lang.String) to or had one returned
> from this call. =A0The tag identifies the consumer. =A0To stop
> consuming you issue basicCancel(tag) on the same channel. =A0
> This stops just this one Consumer. It can be issued from
> another thread.
>
> The Consumer will be called once before it stops:
> handleCancelOk() is the last callback it receives.
>
> But you asked about stopping a >client< from consuming; in
> general there is no general and reliable Java way of stopping
> a thread, and a client may in any case have several threads
> running. To stop a whole client from consuming would require
> application specific code.
>
> Of course closing the channel will stop all the consumers
> but I guess you want something less draconian.
>
> I hope this helps you. If not, please supply more details
> of your application and requirement.
>
> Steve Powell =A0(a happy bunny)
> ----------some definitions from the SPD----------
> Rigatoni n. A prime-ministerial grin.
> Nigella n. The next bottle-size up from a Nebuchadnezzar.
> Homily adv. Rather like a frenchman.
>
> On 20 Oct 2011, at 07:52, dusura wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I would like to tell a Java Client to stop consuming. The client is
> > running in a separate thread. How can I do this?
>
> > I tried interrupting the thread but the RabbitMQ impl swallows
> > InterruptedException.
>
> > Any suggestions would be appreciated.
>
> > Cheers.
>
> > My thread looks like this:
>
> > "Thread-1" prio=3D6 tid=3D0x03766400 nid=3D0x738 in Object.wait()
> > [0x03f0f000]
> > =A0 java.lang.Thread.State: WAITING (on object monitor)
> > =A0 =A0at java.lang.Object.wait(Native Method)
> > =A0 =A0at java.lang.Object.wait(Object.java:485)
> > =A0 =A0at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:50)
> > =A0 =A0- locked <0x22ce4fd8> (a
> > com.rabbitmq.utility.BlockingValueOrException)
> > =A0 =A0at
> > com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:
> > 89)
> > =A0 =A0- locked <0x22ce4fd8> (a
> > com.rabbitmq.utility.BlockingValueOrException)
> > =A0 =A0at
> > com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(B=
lock ingValueOrException.java:
> > 33)
> > =A0 =A0at com.rabbitmq.client.impl.AMQChannel
> > $BlockingRpcContinuation.getReply(AMQChannel.java:337)
> > =A0 =A0at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.jav=
a:
> > 210)
> > =A0 =A0at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel=
.java:
> > 128)
> > =A0 =A0at com.rabbitmq.client.impl.ChannelN.basicGet(ChannelN.java:808)
> > =A0 =A0at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
> > =A0 =A0at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso=
rImp l.java:
> > 25)
> > =A0 =A0at java.lang.reflect.Method.invoke(Method.java:597)
> > ..............
>
> > _______________________________________________
> > rabbitmq-discuss mailing list
> > rabbitmq-disc... at lists.rabbitmq.com
> >https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mai=
lman/listinfo/rabbitmq-discuss


More information about the rabbitmq-discuss mailing list