activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regvito <reggie.v...@copart.com>
Subject Re: ActiveMQ and Resin with JCA
Date Tue, 02 Sep 2008 20:27:47 GMT

My Message Driven bean is configured for auto-acknowledge as shown below.
But just for kicks, I went ahead and acknowldeged the message manually (with
Message.acknowledge() )
But to no avail.  All messages stay stuck in the ActiveMQ queue.

package reggie.test;

import java.util.logging.Logger;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
import javax.jms.TextMessage;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;

@MessageDriven(activationConfig = {
		@ActivationConfigProperty(propertyName = "destination",
							  	  propertyValue = "testQueue"),
		@ActivationConfigProperty(propertyName = "destinationType",
								  propertyValue = "javax.jms.Queue"),
		@ActivationConfigProperty(propertyName = "acknowledgeMode",
								  propertyValue = "Auto-acknowledge"),
		@ActivationConfigProperty(propertyName = "subscriptionDurability",
								  propertyValue = "NonDurable")
		})
public class MyMDB implements MessageListener {
	private static final Logger log = Logger.getLogger(MyMDB.class.getName());

	public void onMessage(Message message) {
		
		try {
	        System.out.println("Some Message received. ");  
	        if (message instanceof ObjectMessage)
	        {
	        	ObjectMessage objectMessage = (ObjectMessage) message;
	
	        	objectMessage.acknowledge();
	            log.info("log Object Message received is "  
	                + objectMessage);
	            System.out.println("Object Message received is "  
	                    + objectMessage.getObject());
	
	        }
	        else if (message instanceof TextMessage)
	        {
	        	TextMessage textMessage = (TextMessage) message;
	
	        	textMessage.acknowledge();
	            log.info("log Text Message received is "  
	                + textMessage.getText());
	            System.out.println("Text Message received is "  
	                    + textMessage.getText());
	
	        }
		}
		catch (JMSException e)
		{
            System.out.println("Error..." + e);  
		
		}
	}
}




Bradley Schaefer-2 wrote:
> 
> Are you acknowledging your consumed messages?
> 
> On Tue, Sep 2, 2008 at 12:38 PM, regvito <reggie.vito@copart.com> wrote:
> 
>>
>> Hi,
>>
>> I am using the Resin 3.2 version with a Message Driven Bean listening to
>> an
>> ActiveMQ Queue remotely connected through JCA with the ActiveMQ 5.1.0 RAR
>> file. Below is my configuration in the resin-web.xml
>>
>> <web-app xmlns="http://caucho.com/ns/resin">
>> <resource-adapter class="org.apache.activemq.ra.ActiveMQResourceAdapter">
>>    <init server-url="tcp://localhost:61616"/>
>> </resource-adapter>
>>  <connection-factory
>> class="org.apache.activemq.ra.ActiveMQManagedConnectionFactory"
>> name="manfactory"/>
>>
>>  <jms-queue name="testResinConQueue"
>> class="org.apache.activemq.command.ActiveMQQueue">
>>  <init physicalName="testResinConQueue"/>
>>  </jms-queue>
>>
>> <ejb-message-bean class="com.test.ejb.ConsumerMessageBean">
>>  <destination>#{testResinConQueue}</destination>
>>  </ejb-message-bean>
>> </web-app>
>>
>> The issue i am observing is that although i see the messages being
>> delivered
>> to the MDB successfully, the messages themseleves are not fully removed
>> from
>> the ActiveMQ Queue resulting in the MDB receiving the same messages
>> everytime resin starts.
>>
>> Any help on this would be appreciated?
>>
>> Thanks in advance.
>> --
>> View this message in context:
>> http://www.nabble.com/ActiveMQ-and-Resin-with-JCA-tp19276889p19276889.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-and-Resin-with-JCA-tp19276889p19277447.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message