You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by mandjeo <ma...@gmail.com> on 2012/07/11 11:15:17 UTC
Pausing messages consuming
Hi everybody,
I am developing ActiveMQ plugin and I would like to pause consuming of
messages from the queues for some time.
I was trying to stop client connections but this breaks the connection
permanently and I don't want that. I would like to pause consuming,
basically same as all the consumers wouldn't call receive message for some
period.
Is there a way to do this from a plugin and if there is please tell me how.
Thanks!!!
--
View this message in context: http://activemq.2283324.n4.nabble.com/Pausing-messages-consuming-tp4653866.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Pausing messages consuming
Posted by sk92129 <sk...@gmail.com>.
I would like to jump into this thread and ask a related question.
I would like to pause message from being consumed selectively, meaning that
I would like to pause message #2 and #4. But all messages to be consumed.
And then let message #2 and #4 to be consumed later.
I think this would create a case where the message order preservation can be
exercised, to allow the consumer to handle cases where messages are coming
off the queue in an order unlike the the order placed into the queue by the
producer.
Basically, I want to be able to force messages to transported from a bridge
of brokers (broker A and broker B), where broker A is being used by the
producer, and broker B is being used by the consumer. The two brokers would
be on separate machines (and VMs), and only tied together by a bridge.
broker B would have this:
<networkConnectors>
<networkConnector uri="static:(ssl://centos-test1:61616)"
duplex="true"/>
</networkConnectors>
broker A would have an empty networkConnector:
<networkConnectors>
</networkConnectors>
--
View this message in context: http://activemq.2283324.n4.nabble.com/Pausing-messages-consuming-tp4653866p4655405.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Pausing messages consuming
Posted by Gary Tully <ga...@gmail.com>.
It is not too importnat; by default, a dispatch to a consumer occurs
on its connection thread so it does not block dispatch to other
consumers or a message send, so it would be possible to use this
technique to selectively block consumers. With asyncDispatch=false,
it would not be possible to be selective.
On 11 July 2012 11:36, mandjeo <ma...@gmail.com> wrote:
> I didn't get what you meant by asyncDispatch.
>
> I tried with blocking preProcessDispatch and it works.
>
> Thanks a lot !!!
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Pausing-messages-consuming-tp4653866p4653880.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
--
http://fusesource.com
http://blog.garytully.com
Re: Pausing messages consuming
Posted by mandjeo <ma...@gmail.com>.
I didn't get what you meant by asyncDispatch.
I tried with blocking preProcessDispatch and it works.
Thanks a lot !!!
--
View this message in context: http://activemq.2283324.n4.nabble.com/Pausing-messages-consuming-tp4653866p4653880.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Pausing messages consuming
Posted by Gary Tully <ga...@gmail.com>.
you could intercept
org.apache.activemq.broker.Broker#preProcessDispatch in your plugin
and block. This will stop all message dispatch from the broker as this
method is called before every message dispatch by the transport.
With asyncDispatch (the default) this will end up blocking the
consumers dispatch thread.
On 11 July 2012 10:20, mandjeo <ma...@gmail.com> wrote:
> I also tried setting the Selector for the consumer to something that will not
> be valid for any of the messages and than when I want to restart consuming
> setting it back, but this doesn't work. Messages keep getting consumed, it's
> like setting the selector after adding the consumer doesn't make any
> effect...
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Pausing-messages-consuming-tp4653866p4653867.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
--
http://fusesource.com
http://blog.garytully.com
Re: Pausing messages consuming
Posted by mandjeo <ma...@gmail.com>.
I also tried setting the Selector for the consumer to something that will not
be valid for any of the messages and than when I want to restart consuming
setting it back, but this doesn't work. Messages keep getting consumed, it's
like setting the selector after adding the consumer doesn't make any
effect...
--
View this message in context: http://activemq.2283324.n4.nabble.com/Pausing-messages-consuming-tp4653866p4653867.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.