Questions on MDB
atulkc May 30, 2013 5:46 PMI faced a couple of issues when deploying MDB in our application and wanted to check if anyone could give some information on it. I am using JBoss 7.2.0.
1) In our application we have defined jms desitnations in hornetq-jms.xml and packaged it in META-INF folder of the ear file. There are some MDBs for some of the topics within our ear. When we deploy the jms destinations this way (in a separate hornetq-jms.xml in META-INF folder) then we observed that the order of jms topic deployment and MDB deployment is not guaranteed. If jms topic deployment happens before MDB deployment then the MDB receives the messages published on the topic else it does not receive anything. Can someone please let me know if there is a way I can define the order of deployment of MDB to be after jms topics/queues are deployed? If I move the jms destinations to standalone-full.xml in messaging subsystem then the order is OK and jms topics/queues always get deployed before MDB as expected. Here is the hornetq-jms.xml and MDB for one of the topics:
hornetq-jms.xml:
<messaging-deployment xmlns="urn:jboss:messaging-deployment:1.0"> <hornetq-server> <jms-destinations> <jms-topic name="topic.dcfm.common"> <entry name="java:jboss/exported/topic/dcfm/Common" /> </jms-topic> <!-- more topic declarations --> </jms-destinations> </hornetq-server> </messaging-deployment>
CommonMDB.java:
@MessageDriven(name = "CommonMDB", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:jboss/exported/topic/dcfm/Common"), @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") }) public class CommonMDB implements MessageListener { private final Logger log = LoggerFactory.getLogger(CommonMDB.class); @Override public void onMessage(Message arg0) { log.info("Received message: {0}", arg0); // do something with the message } }
2) Second problem I am seeing is that if in the above MDB I change the topic name to be some non existent topic ( e.g say I change it to
java:jboss/exported/topic/dcfm/NonExistentTopic) then I do not see any messages in server log indicating that the topic for which the MDB is created does not exist. In JBoss 5.1.0 we were seeing messages like "awaiting topic/queue creation <topic name>. Attempting to reconnect ...". I found this issue accidentally when one of the MDBs had wrong topic name and we were debugging why the MDB is not getting any message. I was expecting to see some indication in server log indicating that MDB is trying to listen to non-existent/undefined topic. Any idea why this is not indicated?