You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Subrata1208 <sa...@GMAIL.COM> on 2008/05/28 11:53:48 UTC

Re: Messages dont get redelivered till broker restart - expected behaviour?

i am using activemq 5.1

i am also getting the same problem.
This is how i am creating factory and connection 
connFactory = new ActiveMQConnectionFactory(url);
		        
				ActiveMQPrefetchPolicy  po = new ActiveMQPrefetchPolicy();
		        po.setQueuePrefetch(1);  
		        connFactory.setPrefetchPolicy(po);	
		        RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
                redeliveryPolicy.setMaximumRedeliveries(-1);
      	        connFactory.setRedeliveryPolicy(redeliveryPolicy);

and my On message method is ::
if (msg instanceof TextMessage) {
				counter++;
				TextMessage mesg = (TextMessage) msg;
				if (mesg != null) {
					String message = null;
					if(mesg != null){
						message = mesg.getText();
						System.out.println("Text Message Received :: "
								+ message);
						if(handler != null){
							status = handler.handleData(message);
							if(status){
								session.commit();
							} else {
								session.rollback();
							}
						}
						message = null;
						mesg = null;
					}				
					
				}
				return;
			}

where there is a prblem with processing a message it is not going to DLQ but
the message never got consumed until i 
restart the broker. 
-- 
View this message in context: http://www.nabble.com/Messages-dont-get-redelivered-till-broker-restart---expected-behaviour--tp9615827s2354p17509046.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Messages dont get redelivered till broker restart - expected behaviour?

Posted by Rob Davies <ra...@gmail.com>.
On 28 May 2008, at 10:53, Subrata1208 wrote:

>
> i am using activemq 5.1
>
> i am also getting the same problem.
> This is how i am creating factory and connection
> connFactory = new ActiveMQConnectionFactory(url);
> 		
> 				ActiveMQPrefetchPolicy  po = new ActiveMQPrefetchPolicy();
> 		        po.setQueuePrefetch(1);
> 		        connFactory.setPrefetchPolicy(po);	
> 		        RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
>                redeliveryPolicy.setMaximumRedeliveries(-1);
>      	        connFactory.setRedeliveryPolicy(redeliveryPolicy);
>
> and my On message method is ::
> if (msg instanceof TextMessage) {
> 				counter++;
> 				TextMessage mesg = (TextMessage) msg;
> 				if (mesg != null) {
> 					String message = null;
> 					if(mesg != null){
> 						message = mesg.getText();
> 						System.out.println("Text Message Received :: "
> 								+ message);
> 						if(handler != null){
> 							status = handler.handleData(message);
> 							if(status){
> 								session.commit();
> 							} else {
> 								session.rollback();
> 							}
> 						}
> 						message = null;
> 						mesg = null;
> 					}				
> 					
> 				}
> 				return;
> 			}
>
> where there is a prblem with processing a message it is not going to  
> DLQ but
> the message never got consumed until i
> restart the broker.
> -- 
> View this message in context: http://www.nabble.com/Messages-dont-get-redelivered-till-broker-restart---expected-behaviour--tp9615827s2354p17509046.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

What if you get a Message which isn't a TextMessage ?


cheers,

Rob

http://open.iona.com/products/enterprise-activemq
http://rajdavies.blogspot.com/