You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by vineet <vi...@gmail.com> on 2017/06/26 21:28:32 UTC

Active MQ Topic -PubSub : Subscriber Blocked because of Fault/Exception

I am using Active MQ 5.14.2 with spring boot  for developing a Pub Sub model
using Topic . 

Following is the problem.: 

1. Producer P1 fires an Event/Message M1 for subscriber S1 and S2. 
 Subscriber S1 is fine and displayed the EnQueue and DeQueue of Message M1. 
 But the Subsciber S2, because of a program exception retry to consume M1
since I have used 
 RedeliveryPolicy. 
    

   policy.setMaximumRedeliveries(5); 
       policy.setInitialRedeliveryDelay(1000); 
       policy.setRedeliveryDelay(10000); 

Now when the M1 is sent again and again for 5 times  with an iteration, the
Subscriber S2 is blocked for  subsequent Messages M2 and M3 which were
published after M1. 

Is there a way that the subscriber S2 can consume M2 and M3 while the 5
redeliveries are happening for M1.What I have experienced is that the
Message M2 and M3 is blocked for Subscriber S2 till M1 goes to Dead Letter
Queue as a Poison Pill. 
This simply makes my system slow. 
Also, I have setDispatchAsync to  true but nothing changes. 

ActiveMQConnection connection = (ActiveMQConnection)
connectionFactory.createConnection(); 
    /* Create Session Acknowledgement         */ 
connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); 
connection.setDispatchAsync(true); 
connection.setUseAsyncSend(true); 

Please let me know is there is a way to handle this scenario to prevent S2
waiting for Message M1 to die before it could consume M2 and M3. 




--
View this message in context: http://activemq.2283324.n4.nabble.com/Active-MQ-Topic-PubSub-Subscriber-Blocked-because-of-Fault-Exception-tp4727900.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Active MQ Topic -PubSub : Subscriber Blocked because of Fault/Exception

Posted by Tim Bain <tb...@alumni.duke.edu>.
Client redelivery works the way you described. For queues, broker
redelivery (see the appropriate section of
http://activemq.apache.org/message-redelivery-and-dlq-handling.html) will
do what you want, but I'm not sure it works for topics. But you could give
it a shot and see if it works.

If not, I don't believe there's a way to do what you want.

Tim (the other one)

On Jun 28, 2017 1:08 PM, "vineet" <vi...@gmail.com> wrote:

> No the Subscribers cannot use the same session. They are independent
> entities
> which would handle their own Message events.
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/Active-MQ-Topic-PubSub-Subscriber-Blocked-
> because-of-Fault-Exception-tp4727900p4728026.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Active MQ Topic -PubSub : Subscriber Blocked because of Fault/Exception

Posted by vineet <vi...@gmail.com>.
No the Subscribers cannot use the same session. They are independent entities
which would handle their own Message events.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Active-MQ-Topic-PubSub-Subscriber-Blocked-because-of-Fault-Exception-tp4727900p4728026.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Active MQ Topic -PubSub : Subscriber Blocked because of Fault/Exception

Posted by Timothy Bish <ta...@gmail.com>.
On 06/26/2017 05:28 PM, vineet wrote:
> I am using Active MQ 5.14.2 with spring boot  for developing a Pub Sub model
> using Topic .
>
> Following is the problem.:
>
> 1. Producer P1 fires an Event/Message M1 for subscriber S1 and S2.
>   Subscriber S1 is fine and displayed the EnQueue and DeQueue of Message M1.
>   But the Subsciber S2, because of a program exception retry to consume M1
> since I have used
>   RedeliveryPolicy.
>      
>
>     policy.setMaximumRedeliveries(5);
>         policy.setInitialRedeliveryDelay(1000);
>         policy.setRedeliveryDelay(10000);
>
> Now when the M1 is sent again and again for 5 times  with an iteration, the
> Subscriber S2 is blocked for  subsequent Messages M2 and M3 which were
> published after M1.
>
> Is there a way that the subscriber S2 can consume M2 and M3 while the 5
> redeliveries are happening for M1.What I have experienced is that the
> Message M2 and M3 is blocked for Subscriber S2 till M1 goes to Dead Letter
> Queue as a Poison Pill.
> This simply makes my system slow.
> Also, I have setDispatchAsync to  true but nothing changes.
>
> ActiveMQConnection connection = (ActiveMQConnection)
> connectionFactory.createConnection();
>      /* Create Session Acknowledgement         */
> connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
> connection.setDispatchAsync(true);
> connection.setUseAsyncSend(true);
>
> Please let me know is there is a way to handle this scenario to prevent S2
> waiting for Message M1 to die before it could consume M2 and M3.
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Active-MQ-Topic-PubSub-Subscriber-Blocked-because-of-Fault-Exception-tp4727900.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Are all the subscribers using the same Session?

-- 
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/