activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Poonam Bhatia <poonam.c.bha...@fisglobal.com>
Subject Re: Aysnc ActiveMQ MDB unable to consume messages
Date Thu, 18 Aug 2016 05:53:06 GMT
Thank you for your reply Tim. I have not used any acknowledgement mode
explicitly. I presume container will handle it and the default ack is
AUTO_ACKNOWLEDGE. Please correct me if I am wrong
Here is my MDB code 
In the below code I have used CDI @Inject used for MessageBus object. Also
attaching ejb-jar.xml for MDB configurations.

Please advise further. 


-------------------------PpNamePinpointListener
-------------------------------------------

public class PpNamePinpointListener implements MessageListener,
MessageDrivenBean
{
   private static final long serialVersionUID = 1L;

   private static final Logger logger = LogManager.getLogger();

   private MessageDrivenContext messageDrivenContext = null;

   @Inject
   @MessageBusType(BusType.MDB_BUS)
   private MessageBus messageBus;

   @Inject
   @BrokerConnectionFactory
   private ConnectionFactory connectionFactory;

   public void ejbCreate()
   {

   }

   @Override
   public void setMessageDrivenContext(MessageDrivenContext
messageDrivenContext)
   {
      this.messageDrivenContext = messageDrivenContext;

   }

   @Override
   public void ejbRemove()
   {

   }

   @Override
   @TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
   public void onMessage(Message message)
   {
      CourierMessage messageObj = null;
      try
      {
         messageObj = messageBus.resolve(message);
         logger
            .info("PpNamePinpointListener received message : " +
messageObj.getBody().toString());
         System.out.println("PpNamePinpointListener received message : "
            + messageObj.getBody().toString());
      }
      catch (CourierException e)
      {
         logger.catching(e);
      }

   }
}

-------------------------------ejb-jar.xml---------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="3.1"
	xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                         
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">
	<enterprise-beans>		
		 <message-driven>
			<display-name>PpNamePinpointListener</display-name>
			<ejb-name>PpNamePinpointListener</ejb-name>
		
<ejb-class>com.fis.ec.courier.reference.PpNamePinpointListener</ejb-class>
			<transaction-type>Container</transaction-type>
			<activation-config>
				<activation-config-property>
				
<activation-config-property-name>destination</activation-config-property-name>
				
<activation-config-property-value>IP_NAME_PP</activation-config-property-value>
				</activation-config-property>
				<activation-config-property>
				
<activation-config-property-name>destinationType</activation-config-property-name>
				
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
				</activation-config-property>
			</activation-config>
		</message-driven> 					
	</enterprise-beans>	
</ejb-jar>

---------------------------Attachments--------------------------
ejb-jar.xml
<http://activemq.2283324.n4.nabble.com/file/n4715621/ejb-jar.xml>  
PpNamePinpointListener.java
<http://activemq.2283324.n4.nabble.com/file/n4715621/PpNamePinpointListener.java>  




--
View this message in context: http://activemq.2283324.n4.nabble.com/Aysnc-ActiveMQ-MDB-unable-to-consume-messages-tp4715582p4715621.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message