Creating a durable subscription to a remote Topic via EJB3 MDBs
bploetz Apr 14, 2010 11:39 AM(NOTE: JBoss 4.2.3)
Hi all,
I'm trying to get the following configuration working and running into an issue:
Server 1: Hosts a Durable Topic, and contains a component (a web app) which publishes mesages to this Topic.
Servers 2-N: Contain EJB3 MDBs which are configured to have durable subscriptions to this remote Topic on Server 1.
On Server 1, I have the following configured:
deploy/jms/networkUpdateTopic-service.xml:
<server> <mbean code="org.jboss.mq.server.jmx.Topic" name="jboss.mq.destination:service=Topic,name=networkUpdateDurableTopic"> <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends> <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends> <attribute name="SecurityConf"> <security> <role name="networkUpdateSubscriber" read="true" write="false" create="true"/> <role name="networkUpdatePublisher" read="true" write="true" create="true"/> </security> </attribute> </mbean> </server>
deploy/jms/oracle-jdbc-state-service.xml:
<server> <!-- ==================================================================== --> <!-- JBossMQ State Management --> <!-- --> <!-- ==================================================================== --> <!-- A Statemanager that stores state in the database --> <mbean code="org.jboss.mq.sm.jdbc.JDBCStateManager" name="jboss.mq:service=StateManager"> <depends optional-attribute-name="ConnectionManager">jboss.jca:service=DataSourceBinding,name=networkDS</depends> <attribute name="SqlProperties"> CREATE_TABLES_ON_STARTUP = TRUE CREATE_USER_TABLE = CREATE TABLE JMS_USERS (USERID VARCHAR(32) NOT NULL, PASSWD VARCHAR(32) NOT NULL, \ CLIENTID VARCHAR(128) NULL, PRIMARY KEY(USERID)) CREATE_ROLE_TABLE = CREATE TABLE JMS_ROLES (ROLEID VARCHAR(32) NOT NULL, USERID VARCHAR(32) NOT NULL, \ PRIMARY KEY(USERID, ROLEID)) CREATE_SUBSCRIPTION_TABLE = CREATE TABLE JMS_SUBSCRIPTIONS (CLIENTID VARCHAR(128) NOT NULL, \ SUBNAME VARCHAR(128) NOT NULL, TOPIC VARCHAR(255) NOT NULL, \ SELECTOR VARCHAR(255) NULL, PRIMARY KEY(CLIENTID, SUBNAME)) GET_SUBSCRIPTION = SELECT TOPIC, SELECTOR FROM JMS_SUBSCRIPTIONS WHERE CLIENTID=? AND SUBNAME=? LOCK_SUBSCRIPTION = SELECT TOPIC, SELECTOR FROM JMS_SUBSCRIPTIONS WHERE CLIENTID=? AND SUBNAME=? GET_SUBSCRIPTIONS_FOR_TOPIC = SELECT CLIENTID, SUBNAME, SELECTOR FROM JMS_SUBSCRIPTIONS WHERE TOPIC=? INSERT_SUBSCRIPTION = INSERT INTO JMS_SUBSCRIPTIONS (CLIENTID, SUBNAME, TOPIC, SELECTOR) VALUES(?,?,?,?) UPDATE_SUBSCRIPTION = UPDATE JMS_SUBSCRIPTIONS SET TOPIC=?, SELECTOR=? WHERE CLIENTID=? AND SUBNAME=? REMOVE_SUBSCRIPTION = DELETE FROM JMS_SUBSCRIPTIONS WHERE CLIENTID=? AND SUBNAME=? GET_USER_BY_CLIENTID = SELECT USERID, PASSWD, CLIENTID FROM JMS_USERS WHERE CLIENTID=? GET_USER = SELECT PASSWD, CLIENTID FROM JMS_USERS WHERE USERID=? POPULATE.TABLES.01 = INSERT INTO JMS_USERS (USERID, PASSWD, CLIENTID) VALUES ('network', 'network', 'network') POPULATE.TABLES.02 = INSERT INTO JMS_USERS (USERID, PASSWD, CLIENTID) VALUES ('whitelabel1', 'whitelabel1', 'whitelabel1') POPULATE.TABLES.03 = INSERT INTO JMS_USERS (USERID, PASSWD, CLIENTID) VALUES ('whitelabel2', 'whitelabel2', 'whitelabel2') POPULATE.TABLES.04 = INSERT INTO JMS_ROLES (ROLEID, USERID) VALUES ('networkUpdateSubscriber', 'whitelabel1') POPULATE.TABLES.05 = INSERT INTO JMS_ROLES (ROLEID, USERID) VALUES ('networkUpdateSubscriber', 'whitelabel2') POPULATE.TABLES.06 = INSERT INTO JMS_ROLES (ROLEID, USERID) VALUES ('networkUpdatePublisher', 'network') POPULATE.TABLES.07 = INSERT INTO JMS_SUBSCRIPTIONS (CLIENTID, SUBNAME, TOPIC) VALUES ('whitelabel1', 'networkUpdateSubscription', 'topic/networkUpdateDurableTopic') POPULATE.TABLES.08 = INSERT INTO JMS_SUBSCRIPTIONS (CLIENTID, SUBNAME, TOPIC) VALUES ('whitelabel2', 'networkUpdateSubscription', 'topic/networkUpdateDurableTopic') </attribute> </mbean> </server>
deploy/jms/oracle-jdbc2-service.xml:
<server> <!-- ==================================================================== --> <!-- Persistence and caching using Oracle --> <!-- IMPORTANT: Remove hsqldb-jdbc2-service.xml --> <!-- ==================================================================== --> <!-- | The destination manager is the core service within JBossMQ --> <mbean code="org.jboss.mq.server.jmx.DestinationManager" name="jboss.mq:service=DestinationManager"> <depends optional-attribute-name="MessageCache">jboss.mq:service=MessageCache</depends> <depends optional-attribute-name="PersistenceManager">jboss.mq:service=PersistenceManager</depends> <depends optional-attribute-name="StateManager">jboss.mq:service=StateManager</depends> <depends optional-attribute-name="ThreadPool">jboss.mq:service=ThreadPool</depends> <depends>jboss:service=Naming</depends> </mbean> <!-- | The MessageCache decides where to put JBossMQ message that | are sitting around waiting to be consumed by a client. | | The memory marks are in Megabytes. Once the JVM memory usage hits | the high memory mark, the old messages in the cache will start getting | stored in the DataDirectory. As memory usage gets closer to the | Max memory mark, the amount of message kept in the memory cache aproaches 0. --> <mbean code="org.jboss.mq.server.MessageCache" name="jboss.mq:service=MessageCache"> <attribute name="HighMemoryMark">50</attribute> <attribute name="MaxMemoryMark">60</attribute> <attribute name="CacheStore">jboss.mq:service=PersistenceManager</attribute> </mbean> <!-- The PersistenceManager is used to store messages to disk. --> <!-- | The jdbc2 PersistenceManager is the new improved JDBC implementation. | This implementation allows you to control how messages are stored in | the database. | | This jdbc2 PM configuration has been tested against Oracle | | Use the OracleThinPeristenceManager if you have the 4K limit problem for blobs | this uses the INSERT_EMPTY_BLOB and LOCK_EMPTY_BLOB before updating the row | with the real blob data to workaround that limit. --> <!--mbean code="org.jboss.mq.pm.jdbc2.OracleThinPersistenceManager" --> <mbean code="org.jboss.mq.pm.jdbc2.PersistenceManager" name="jboss.mq:service=PersistenceManager"> <depends optional-attribute-name="ConnectionManager">jboss.jca:service=DataSourceBinding,name=networkDS</depends> <attribute name="SqlProperties"> INSERT_EMPTY_BLOB = INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,EMPTY_BLOB(),?,?) LOCK_EMPTY_BLOB = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE MESSAGEID = ? AND DESTINATION = ? FOR UPDATE BLOB_TYPE=BINARYSTREAM_BLOB INSERT_TX = INSERT INTO JMS_TRANSACTIONS (TXID) values(?) INSERT_MESSAGE = INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?) SELECT_ALL_UNCOMMITED_TXS = SELECT TXID FROM JMS_TRANSACTIONS SELECT_MAX_TX = SELECT MAX(TXID) FROM (SELECT MAX(TXID) AS TXID FROM JMS_TRANSACTIONS UNION SELECT MAX(TXID) AS TXID FROM JMS_MESSAGES) DELETE_ALL_TX = DELETE FROM JMS_TRANSACTIONS SELECT_MESSAGES_IN_DEST = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE DESTINATION=? SELECT_MESSAGE_KEYS_IN_DEST = SELECT MESSAGEID FROM JMS_MESSAGES WHERE DESTINATION=? SELECT_MESSAGE = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=? MARK_MESSAGE = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE MESSAGEID=? AND DESTINATION=? UPDATE_MESSAGE = UPDATE JMS_MESSAGES SET MESSAGEBLOB=? WHERE MESSAGEID=? AND DESTINATION=? UPDATE_MARKED_MESSAGES = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? UPDATE_MARKED_MESSAGES_WITH_TX = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? AND TXID=? DELETE_MARKED_MESSAGES_WITH_TX = DELETE FROM JMS_MESSAGES MESS WHERE TXOP=? AND EXISTS (SELECT TXID FROM JMS_TRANSACTIONS TX WHERE TX.TXID = MESS.TXID) DELETE_TX = DELETE FROM JMS_TRANSACTIONS WHERE TXID = ? DELETE_MARKED_MESSAGES = DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=? DELETE_TEMPORARY_MESSAGES = DELETE FROM JMS_MESSAGES WHERE TXOP='T' DELETE_MESSAGE = DELETE FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=? CREATE_MESSAGE_TABLE = CREATE TABLE JMS_MESSAGES ( MESSAGEID INTEGER NOT NULL, \ DESTINATION VARCHAR(255) NOT NULL, TXID INTEGER, TXOP CHAR(1), \ MESSAGEBLOB BLOB, PRIMARY KEY (MESSAGEID, DESTINATION) ) CREATE_IDX_MESSAGE_TXOP_TXID = CREATE INDEX JMS_MESSAGES_TXOP_TXID ON JMS_MESSAGES (TXOP, TXID) CREATE_IDX_MESSAGE_DESTINATION = CREATE INDEX JMS_MESSAGES_DESTINATION ON JMS_MESSAGES (DESTINATION) CREATE_TX_TABLE = CREATE TABLE JMS_TRANSACTIONS ( TXID INTEGER, PRIMARY KEY (TXID) ) CREATE_TABLES_ON_STARTUP = TRUE </attribute> <!-- Uncomment to override the transaction timeout for recovery per queue/subscription, in seconds --> <!--attribute name="RecoveryTimeout">0</attribute--> <!-- The number of blobs to load at once during message recovery --> <attribute name="RecoverMessagesChunk">0</attribute> </mbean> </server>
The JMS tables in Server 1's database appear to get populated correctly, and I see the following output when Server 1 starts up:
10:52:47,275 TRACE [Invoker] Constructing 10:52:47,275 TRACE [InterceptorLoader] Constructing 10:52:47,291 TRACE [SecurityManager] Constructing 10:52:47,400 TRACE [SecurityMetadata] Adding role: Role {name=guest;read=true;write=true;create=true} 10:52:47,463 TRACE [Queue] Constructing 10:52:47,510 TRACE [JVMServerILService] Constructing 10:52:47,525 TRACE [Topic] Constructing 10:52:47,541 DEBUG [networkUpdateDurableTopic] Setting securityConf: [security: null] 10:52:47,557 TRACE [JDBCStateManager] Constructing 10:52:47,588 TRACE [DestinationManager] Constructing 10:52:47,588 TRACE [MessageCache] Constructing 10:52:47,619 TRACE [PersistenceManager] Constructing 10:52:47,635 DEBUG [MessageCache] Creating jboss.mq:service=MessageCache 10:52:47,635 DEBUG [MessageCache] Created jboss.mq:service=MessageCache 10:52:47,635 DEBUG [MessageCache] Starting jboss.mq:service=MessageCache 10:52:47,635 DEBUG [MessageCache] Started jboss.mq:service=MessageCache 10:52:47,666 TRACE [UILServerILService] Constructing 10:52:49,369 TRACE [JMSProviderLoader] Constructing 10:52:49,385 TRACE [ServerSessionPoolLoader] Constructing 10:52:49,478 DEBUG [JMSProviderLoader] Creating jboss.mq:service=JMSProviderLoader,name=JMSProvider 10:52:49,478 DEBUG [JMSProviderLoader] Created jboss.mq:service=JMSProviderLoader,name=JMSProvider 10:52:49,478 DEBUG [ServerSessionPoolLoader] Creating jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool 10:52:49,478 DEBUG [ServerSessionPoolLoader] Created jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool 10:52:49,478 DEBUG [JMSProviderLoader] Starting jboss.mq:service=JMSProviderLoader,name=JMSProvider 10:52:49,478 DEBUG [JMSProviderLoader] attempting to bind org.jboss.jms.jndi.JNDIProviderAdapter@13e6f83 to java:/DefaultJMSProvider 10:52:49,494 DEBUG [JMSProviderLoader] Bound adapter to java:/DefaultJMSProvider 10:52:49,494 DEBUG [JMSProviderLoader] Started jboss.mq:service=JMSProviderLoader,name=JMSProvider 10:52:49,494 DEBUG [ServerSessionPoolLoader] Starting jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool 10:52:49,494 DEBUG [ServerSessionPoolLoader] initialized with pool factory: org.jboss.jms.asf.StdServerSessionPoolFactory@5e7663 10:52:49,494 DEBUG [ServerSessionPoolLoader] pool factory StdJMSPool bound to java:/StdJMSPool 10:52:49,494 DEBUG [ServerSessionPoolLoader] Started jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool 10:52:49,557 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA' 10:52:49,666 DEBUG [JDBCStateManager] Creating jboss.mq:service=StateManager 10:52:49,666 DEBUG [JDBCStateManager] Created jboss.mq:service=StateManager 10:52:49,666 DEBUG [PersistenceManager] Creating jboss.mq:service=PersistenceManager 10:52:49,666 DEBUG [PersistenceManager] Created jboss.mq:service=PersistenceManager 10:52:49,666 DEBUG [DestinationManager] Creating jboss.mq:service=DestinationManager 10:52:49,682 DEBUG [DestinationManager] Created jboss.mq:service=DestinationManager 10:52:49,682 DEBUG [SecurityManager] Creating jboss.mq:service=SecurityManager 10:52:49,682 DEBUG [SecurityManager] Created jboss.mq:service=SecurityManager 10:52:49,682 DEBUG [InterceptorLoader] Creating jboss.mq:service=TracingInterceptor 10:52:49,682 DEBUG [InterceptorLoader] Created jboss.mq:service=TracingInterceptor 10:52:49,682 DEBUG [Invoker] Creating jboss.mq:service=Invoker 10:52:49,682 DEBUG [Invoker] Created jboss.mq:service=Invoker 10:52:49,682 DEBUG [HTTPServerILService] Creating jboss.mq:service=InvocationLayer,type=HTTP 10:52:49,682 DEBUG [HTTPServerILService] Created jboss.mq:service=InvocationLayer,type=HTTP 10:52:49,682 DEBUG [JVMServerILService] Creating jboss.mq:service=InvocationLayer,type=JVM 10:52:49,682 DEBUG [JVMServerILService] Created jboss.mq:service=InvocationLayer,type=JVM 10:52:49,682 DEBUG [UILServerILService] Creating jboss.mq:service=InvocationLayer,type=UIL2 10:52:49,682 DEBUG [UILServerILService] Created jboss.mq:service=InvocationLayer,type=UIL2 10:52:49,682 DEBUG [DLQ] Creating jboss.mq.destination:service=Queue,name=DLQ 10:52:49,682 DEBUG [DLQ] Created jboss.mq.destination:service=Queue,name=DLQ 10:52:49,682 DEBUG [networkUpdateDurableTopic] Creating jboss.mq.destination:service=Topic,name=networkUpdateDurableTopic 10:52:49,682 DEBUG [networkUpdateDurableTopic] Created jboss.mq.destination:service=Topic,name=networkUpdateDurableTopic 10:52:49,713 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=networkDS' to JNDI name 'java:networkDS' 10:52:50,369 DEBUG [JDBCStateManager] Starting jboss.mq:service=StateManager ............................ 10:52:50,838 DEBUG [PersistenceManager] Resolving uncommited TXS 10:52:50,838 DEBUG [PersistenceManager] Started jboss.mq:service=PersistenceManager 10:52:50,838 DEBUG [DestinationManager] Starting jboss.mq:service=DestinationManager 10:52:50,853 DEBUG [DestinationManager] Started jboss.mq:service=DestinationManager 10:52:50,853 DEBUG [SecurityManager] Starting jboss.mq:service=SecurityManager 10:52:50,869 DEBUG [SecurityManager] Started jboss.mq:service=SecurityManager 10:52:50,869 DEBUG [InterceptorLoader] Starting jboss.mq:service=TracingInterceptor 10:52:50,869 DEBUG [InterceptorLoader] Started jboss.mq:service=TracingInterceptor 10:52:50,869 DEBUG [Invoker] Starting jboss.mq:service=Invoker 10:52:50,869 DEBUG [Invoker] Started jboss.mq:service=Invoker 10:52:50,869 DEBUG [HTTPServerILService] Starting jboss.mq:service=InvocationLayer,type=HTTP 10:52:50,869 TRACE [HTTPClient] created(String http://127.0.0.1:8080/jbossmq-httpil/HTTPServerILServlet) 10:52:50,900 DEBUG [HTTPServerILService] Started jboss.mq:service=InvocationLayer,type=HTTP 10:52:50,900 DEBUG [JVMServerILService] Starting jboss.mq:service=InvocationLayer,type=JVM 10:52:50,900 DEBUG [JVMServerILService] Started jboss.mq:service=InvocationLayer,type=JVM 10:52:50,900 DEBUG [UILServerILService] Starting jboss.mq:service=InvocationLayer,type=UIL2 10:52:50,900 INFO [UILServerILService] JBossMQ UIL service available at : /127.0.0.1:8093 10:52:50,900 TRACE [TracingInterceptor] CALLED : getThreadGroup 10:52:50,900 TRACE [TracingInterceptor] RETURN : getThreadGroup 10:52:50,932 DEBUG [UILServerILService] Started jboss.mq:service=InvocationLayer,type=UIL2 10:52:50,932 DEBUG [DLQ] Starting jboss.mq.destination:service=Queue,name=DLQ 10:52:50,947 DEBUG [PersistenceManager] Restored 0 message(s) to: QUEUE.DLQ 0 need recovery. 10:52:50,947 INFO [DLQ] Bound to JNDI name: queue/DLQ 10:52:50,947 TRACE [SecurityMetadata] Adding role: Role {name=guest;read=true;write=true;create=true} 10:52:50,947 DEBUG [DLQ] Started jboss.mq.destination:service=Queue,name=DLQ 10:52:50,947 DEBUG [networkUpdateDurableTopic] Starting jboss.mq.destination:service=Topic,name=networkUpdateDurableTopic 10:52:50,963 INFO [networkUpdateDurableTopic] Bound to JNDI name: topic/networkUpdateDurableTopic 10:52:50,963 TRACE [SecurityMetadata] Adding role: Role {name=networkUpdateSubscriber;read=true;write=false;create=true} 10:52:50,963 TRACE [SecurityMetadata] Adding role: Role {name=networkUpdatePublisher;read=true;write=true;create=true} 10:52:50,963 DEBUG [networkUpdateDurableTopic] Started jboss.mq.destination:service=Topic,name=networkUpdateDurableTopic
And the web app within Server 1 is able to publish messages to the Topic successfully.
Servers 2 -> N are configured like so. I have set up a JNDIProviderAdapter to talk to Server 1's JNDI to get a reference to the remote Topic (NOTE: all servers are running on my laptop at the moment, which is why the host is "localhost").
deploy/jms/jms-ds.xml:
<?xml version="1.0" encoding="UTF-8"?> <connection-factories> <!-- ==================================================================== --> <!-- JMS Stuff --> <!-- ==================================================================== --> <!-- Remote provider for the Network Update Topic --> <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="jboss.mq:service=JMSProviderLoader,name=NetworkUpdateJMSProvider,server=localhost"> <attribute name="ProviderName">NetworkUpdateJMSProvider</attribute> <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute> <!-- The connection factory --> <attribute name="FactoryRef">UIL2XAConnectionFactory</attribute> <!-- The queue connection factory --> <attribute name="QueueFactoryRef">UIL2XAConnectionFactory</attribute> <!-- The topic factory --> <attribute name="TopicFactoryRef">UIL2XAConnectionFactory</attribute> <!-- Connect to JNDI on the host "localhost" port 1099--> <attribute name="Properties"> java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jnp.interfaces java.naming.provider.url=localhost:1099 </attribute> </mbean> <!-- The server session pool for Message Driven Beans --> <mbean code="org.jboss.jms.asf.ServerSessionPoolLoader" name="jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool"> <depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends> <attribute name="PoolName">StdJMSPool</attribute> <attribute name="PoolFactoryClass"> org.jboss.jms.asf.StdServerSessionPoolFactory </attribute> </mbean> <!-- JMS XA Resource adapter, use this to get transacted JMS in beans --> <tx-connection-factory> <jndi-name>JmsXA</jndi-name> <xa-transaction/> <rar-name>jms-ra.rar</rar-name> <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition> <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property> <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/NetworkUpdateJMSProvider</config-property> <security-domain-and-application>JmsXARealm</security-domain-and-application> <max-pool-size>20</max-pool-size> </tx-connection-factory> </connection-factories>
Code for EJB3 MDB running on Server 2-N:
package com.xxx.wl.ejb; import javax.jms.MessageListener; import javax.jms.Message; import javax.ejb.MessageDriven; import javax.ejb.ActivationConfigProperty; @MessageDriven(name="NetworkUpdateMDB", activationConfig = { @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Topic"), @ActivationConfigProperty(propertyName="destination", propertyValue="topic/networkUpdateDurableTopic"), @ActivationConfigProperty(propertyName="providerAdapterJNDI", propertyValue="java:/NetworkUpdateJMSProvider"), @ActivationConfigProperty(propertyName="acknowledgeMode", propertyValue="Auto-acknowledge"), @ActivationConfigProperty(propertyName="subscriptionDurability", propertyValue="Durable"), @ActivationConfigProperty(propertyName="subscriptionName", propertyValue="networkUpdateSubscription") } ) public class NetworkUpdateMDB implements MessageListener { public void onMessage(Message msg) { System.out.println("\n\n\nGOT NETWORK UPDATE MESSAGE!"); } }
EJB3 MDB's jboss.xml:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd"> <jboss> <enterprise-beans> <message-driven> <ejb-name>NetworkUpdateMDB</ejb-name> <destination-jndi-name>topic/networkUpdateDurableTopic</destination-jndi-name> <mdb-user>whitelabel1</mdb-user> <mdb-passwd>whitelabel1</mdb-passwd> <mdb-subscription-id>networkUpdateSubscription</mdb-subscription-id> </message-driven> </enterprise-beans> </jboss>
Upon starting Server 2 I get the following error:
11:28:39,198 DEBUG [PersistenceManager] Resolving uncommited TXS 11:28:39,213 DEBUG [PersistenceManager] Started jboss.mq:service=PersistenceManager 11:28:39,213 DEBUG [DestinationManager] Starting jboss.mq:service=DestinationManager 11:28:39,213 DEBUG [DestinationManager] Started jboss.mq:service=DestinationManager 11:28:39,213 DEBUG [SecurityManager] Starting jboss.mq:service=SecurityManager 11:28:39,229 DEBUG [SecurityManager] Started jboss.mq:service=SecurityManager 11:28:39,229 DEBUG [InterceptorLoader] Starting jboss.mq:service=TracingInterceptor 11:28:39,229 DEBUG [InterceptorLoader] Started jboss.mq:service=TracingInterceptor 11:28:39,229 DEBUG [Invoker] Starting jboss.mq:service=Invoker 11:28:39,229 DEBUG [Invoker] Started jboss.mq:service=Invoker 11:28:39,229 DEBUG [HTTPServerILService] Starting jboss.mq:service=InvocationLayer,type=HTTP 11:28:39,276 DEBUG [HTTPServerILService] Started jboss.mq:service=InvocationLayer,type=HTTP 11:28:39,276 DEBUG [JVMServerILService] Starting jboss.mq:service=InvocationLayer,type=JVM 11:28:39,276 DEBUG [JVMServerILService] Started jboss.mq:service=InvocationLayer,type=JVM 11:28:39,276 DEBUG [UILServerILService] Starting jboss.mq:service=InvocationLayer,type=UIL2 11:28:39,276 INFO [UILServerILService] JBossMQ UIL service available at : /127.0.0.1:8293 11:28:39,307 DEBUG [UILServerILService] Started jboss.mq:service=InvocationLayer,type=UIL2 11:28:39,307 DEBUG [DLQ] Starting jboss.mq.destination:service=Queue,name=DLQ 11:28:39,323 DEBUG [PersistenceManager] Restored 0 message(s) to: QUEUE.DLQ 0 need recovery. 11:28:39,323 INFO [DLQ] Bound to JNDI name: queue/DLQ 11:28:39,323 DEBUG [DLQ] Started jboss.mq.destination:service=Queue,name=DLQ 11:28:39,448 DEBUG [JMSProviderLoader] Creating jboss.mq:service=JMSProviderLoader,name=NetworkUpdateJMSProvider,server=localhost 11:28:39,448 DEBUG [JMSProviderLoader] Created jboss.mq:service=JMSProviderLoader,name=NetworkUpdateJMSProvider,server=localhost 11:28:39,495 DEBUG [ServerSessionPoolLoader] Creating jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool 11:28:39,495 DEBUG [ServerSessionPoolLoader] Created jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool 11:28:39,495 DEBUG [JMSProviderLoader] Starting jboss.mq:service=JMSProviderLoader,name=NetworkUpdateJMSProvider,server=localhost 11:28:39,495 DEBUG [JMSProviderLoader] attempting to bind org.jboss.jms.jndi.JNDIProviderAdapter@d8355 to java:/NetworkUpdateJMSProvider 11:28:39,495 DEBUG [JMSProviderLoader] Bound adapter to java:/NetworkUpdateJMSProvider 11:28:39,495 DEBUG [JMSProviderLoader] Started jboss.mq:service=JMSProviderLoader,name=NetworkUpdateJMSProvider,server=localhost 11:28:39,495 DEBUG [ServerSessionPoolLoader] Starting jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool 11:28:39,510 DEBUG [ServerSessionPoolLoader] initialized with pool factory: org.jboss.jms.asf.StdServerSessionPoolFactory@47c130 11:28:39,510 DEBUG [ServerSessionPoolLoader] pool factory StdJMSPool bound to java:/StdJMSPool 11:28:39,510 DEBUG [ServerSessionPoolLoader] Started jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool 11:28:39,838 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA' 11:28:40,385 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.mdb.MDB 11:28:40,401 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=wl.network-update-mdb-1.0-SNAPSHOT.jar,name=NetworkUpdateMDB,service=EJB3 with dependencies: 11:28:40,432 INFO [EJBContainer] STARTED EJB: com.upromise.module.app.wl.ejb.NetworkUpdateMDB ejbName: NetworkUpdateMDB 11:28:40,479 DEBUG [SpyDestinationObjectFactory] SpyDestinationObjectFactory->getObjectInstance() 11:28:40,510 INFO [EJB3Deployer] Deployed: file:/E:/jboss/jboss-4.2.3.GA/server/wl1/deploy/wl.network-update-mdb-1.0-SNAPSHOT.jar 11:28:40,526 DEBUG [SpyDestinationObjectFactory] SpyDestinationObjectFactory->getObjectInstance() 11:28:40,526 DEBUG [SpyConnectionFactoryObjectFactory] Extracting SpyConnectionFactory from reference 11:28:40,526 DEBUG [SpyConnectionFactoryObjectFactory] The GenericConnectionFactory is: GenericConnectionFactory[server=org.jboss.mq.il.uil2.UILServerIL@402e11 connectionProperties={ClientILService=org.jboss.mq.il.uil2.UILClientILService, UIL_TCPNODELAY_KEY=yes, UIL_CHUNKSIZE_KEY=1000000, UIL_CONNECTADDRESS_KEY=null, UIL_CONNECTPORT_KEY=0, UIL_SOTIMEOUT_KEY=120000, UIL_RECEIVE_REPLIES_KEY=No, UIL_ADDRESS_KEY=127.0.0.1, UIL_PORT_KEY=8093, PingPeriod=60000, UIL_BUFFERSIZE_KEY=2048}] 11:28:40,542 DEBUG [Connection] Setting the clockDaemon's thread factory 11:28:40,557 DEBUG [SocketManager] Begin WriteTask.run Thread[UIL2.SocketManager.WriteTask#2 client=127.0.0.1:8093,5,JBossMQ Client Threads] 11:28:40,557 DEBUG [SocketManager] Created ObjectOutputStream 11:28:40,557 DEBUG [SocketManager] Begin ReadTask.run Thread[UIL2.SocketManager.ReadTask#1 client=127.0.0.1:8093,5,JBossMQ Client Threads] 11:28:40,573 DEBUG [SocketManager] Created ObjectInputStream 11:28:40,573 DEBUG [UILClientILService] Starting 11:28:40,620 DEBUG [SpyDestinationObjectFactory] SpyDestinationObjectFactory->getObjectInstance() 11:28:40,620 DEBUG [SpyConnectionFactoryObjectFactory] Extracting SpyConnectionFactory from reference 11:28:40,620 DEBUG [SpyConnectionFactoryObjectFactory] The GenericConnectionFactory is: GenericConnectionFactory[server=org.jboss.mq.il.uil2.UILServerIL@788b76 connectionProperties={ClientILService=org.jboss.mq.il.uil2.UILClientILService, UIL_TCPNODELAY_KEY=yes, UIL_CHUNKSIZE_KEY=1000000, UIL_CONNECTADDRESS_KEY=null, UIL_CONNECTPORT_KEY=0, UIL_SOTIMEOUT_KEY=120000, UIL_RECEIVE_REPLIES_KEY=No, UIL_ADDRESS_KEY=127.0.0.1, UIL_PORT_KEY=8093, PingPeriod=60000, UIL_BUFFERSIZE_KEY=2048}] 11:28:40,635 DEBUG [SocketManager] Begin ReadTask.run Thread[UIL2.SocketManager.ReadTask#3 client=127.0.0.1:8093,5,JBossMQ Client Threads] 11:28:40,667 DEBUG [SocketManager] Begin WriteTask.run Thread[UIL2.SocketManager.WriteTask#4 client=127.0.0.1:8093,5,JBossMQ Client Threads] 11:28:40,667 DEBUG [SocketManager] Created ObjectOutputStream 11:28:40,667 DEBUG [SocketManager] Created ObjectInputStream 11:28:40,667 DEBUG [UILClientILService] Starting 11:28:41,135 WARN [JmsActivation] Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@9ac272(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@2b16b8 destination=topic/networkUpdateDurableTopic isTopic=true tx=true durable=true subscription=networkUpdateSubscription reconnect=10 provider=java:/NetworkUpdateJMSProvider user=whitelabel1 pass=<not shown> maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=5) javax.jms.InvalidDestinationException: Previous topic does not exist: TOPIC.topic/networkUpdateDurableTopic at org.jboss.mq.sm.AbstractStateManager.setDurableSubscription(AbstractStateManager.java:143) at org.jboss.mq.server.JMSTopic.addSubscriber(JMSTopic.java:112) at org.jboss.mq.server.ClientConsumer.addSubscription(ClientConsumer.java:156) at org.jboss.mq.server.JMSDestinationManager.subscribe(JMSDestinationManager.java:596) at org.jboss.mq.server.JMSServerInterceptorSupport.subscribe(JMSServerInterceptorSupport.java:171) at org.jboss.mq.security.ServerSecurityInterceptor.subscribe(ServerSecurityInterceptor.java:157) at org.jboss.mq.server.TracingInterceptor.subscribe(TracingInterceptor.java:651) at org.jboss.mq.server.JMSServerInvoker.subscribe(JMSServerInvoker.java:177) at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:188) at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:419) at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:398) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:761) at java.lang.Thread.run(Thread.java:595) 11:28:41,229 DEBUG [SocketManager] End ReadTask.run Thread[UIL2.SocketManager.ReadTask#3 client=127.0.0.1:8093,5,JBossMQ Client Threads] 11:28:41,229 DEBUG [SocketManager] End WriteTask.run Thread[UIL2.SocketManager.WriteTask#4 client=127.0.0.1:8093,5,JBossMQ Client Threads] 11:28:41,260 DEBUG [UILClientILService] Stopping 11:28:41,291 DEBUG [SocketManager] End ReadTask.run Thread[UIL2.SocketManager.ReadTask#1 client=127.0.0.1:8093,5,JBossMQ Client Threads] 11:28:41,291 DEBUG [UILClientILService] Stopping 11:28:41,291 DEBUG [SocketManager] End WriteTask.run Thread[UIL2.SocketManager.WriteTask#2 client=127.0.0.1:8093,5,JBossMQ Client Threads]
Now it *appears* that it can't find the topic/networkUpdateDurableTopic object in the remote JNDI because for some reason it's appending TOPIC. to the Desitnation name, but that might be a red herring.
Thanks in advance for any help you may have in getting this configured correctly.
BP