Hi,
I am relatively new to JMS and have been looking to migrate our current JBossMQ
implementation of JMS to ActiveMQ and at the same time move from using JBoss 3.2.3 to
JBoss 4.0.4.
Our product is deployed over two servers whereby MDBs deployed on server1 will write to
queues located on server2 which server2 will then read from. Server2 also writes to queues
located on itself that server1 will read from. Finally server1 also has some local queues
that it writes to and reads from (accessed by server1 only).
This above-mentioned setup is working perfectly fine with the JBossMQ implementation of
JMS and the only reason why we are migrating to ActiveMQ is because JBossMQ doesnt support
indexing on message selectors (i.e. when a queue that has multiple receivers, which
receive messages based on a msg selector, grows large with messages that dont match a
particular receiver, performance degrades significantly).
Now the question I'm asking is a newbie one in relation to MDBs reading from remote
JMS queues. It was my understanding that to achieve this one would have to follow
something similar to:
http://wiki.jboss.org/wiki/Wiki.jsp?page=HowDoIConfigureAnMDBToTalkToARem...
Which is pretty much identical to the way we have set up with JBossMQ. But when it comes
to ActiveMQ I couldnt find any samples that show me how to do this (the ActiveMQ Jboss
Integration Guide seems to take a different approach thats not for remote queue access).
Does this mean there is another way to do it? (btw, I will also post this on the ActiveMQ
forums but wanted to get an idea from the Jboss community as to whether there are
better/different ways of doing this)
I will appreciate any guidance (even RTFM advice but with references please). Like what
should I read first, and what comes next, etc... because at the moment there seems to be
loads of information that I cant make much sense of in terms what links with what.
Thanks,
cosjav
P.S the attempts I have made so far are shown below:
I changed the server1 JMSProviderLoader (contained in a file named
jms-providers-service.xml in deploy/jms) details from:
<server>
| <!--
| JMS Providers to access server2 queues
| -->
| <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
|
name="jboss.mq:service=JMSProviderLoader,name=RemoteJBossMQProvider_server2">
| <attribute
name="ProviderName">RemoteJMSProvider_server2</attribute>
| <attribute
name="ProviderUrl">jnp://server2:1099</attribute>
| <attribute
name="ProviderAdapterClass">org.jboss.jms.jndi.JBossMQProvider</attribute>
| <attribute
name="QueueFactoryRef">UIL2XAConnectionFactory</attribute>
| <attribute
name="TopicFactoryRef">UIL2XAConnectionFactory</attribute>
| </mbean>
|
| </server>
to
<server>
| <!--
| JMS Providers to access server2 queues
| -->
| <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
|
name="jboss.mq:service=JMSProviderLoader,name=RemoteActiveMQProvider_server2,server=server2">
| <attribute
name="ProviderName">RemoteJMSProvider_indium</attribute>
| <attribute
name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
| <!--<attribute
name="QueueFactoryRef">ConnectionFactory</attribute>-->
| <attribute
name="QueueFactoryRef">ActiveMQConnectionFactory</attribute>
| <attribute
name="TopicFactoryRef">ActiveMQConnectionFactory</attribute>
| <attribute name="Properties">
|
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
| java.naming.factory.url.pkgs=org.jnp.interfaces
| java.naming.provider.url=server2:1099
| </attribute>
| </mbean>
| </server>
|
(I think I have set the connection factory incorrectly above because I'm getting
exceptions saying "javax.naming.NameNotFoundException:
ActiveMQConnectionFactory")
Then I changed jms-ds.xml (in deploy/jms) on server1 from:
<tx-connection-factory>
| <jndi-name>RemoteJmsXA_server2</jndi-name>
| <xa-transaction/>
| <track-connection-by-tx>true</track-connection-by-tx>
| <adapter-display-name>JMS Adapter</adapter-display-name>
| <config-property name="JmsProviderAdapterJNDI"
type="java.lang.String">java:/RemoteJMSProvider_server2</config-property>
| <config-property name="SessionDefaultType"
type="java.lang.String">javax.jms.Queue</config-property>
|
<security-domain-and-application>RemoteJmsXA_server2_Realm</security-domain-and-application>
| <max-pool-size>100</max-pool-size>
| </tx-connection-factory>
|
to
<tx-connection-factory>
| <jndi-name>RemoteJmsXA_server2</jndi-name>
| <xa-transaction/>
| <track-connection-by-tx/>
| <adapter-display-name>JMS Adapter</adapter-display-name>
| <config-property name="JmsProviderAdapterJNDI"
type="java.lang.String">java:/RemoteJMSProvider_server2</config-property>
| <config-property name="SessionDefaultType"
type="java.lang.String">javax.jms.Queue</config-property>
|
<security-domain-and-application>RemoteJmsXA_server2_Realm</security-domain-and-application>
| <max-pool-size>100</max-pool-size>
| <rar-name>activemq-ra-4.0.1.rar</rar-name>
|
<connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
| </tx-connection-factory>
|
(this was changed based on the ActiveMQ sample)
Finally I changed a the queue definitons from:
<mbean code="org.jboss.mq.server.jmx.Queue"
| name="jboss.mq.destination:service=Queue,name=queue1">
| <depends
optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
| </mbean>
to
<mbean code="org.jboss.resource.deployment.AdminObject"
name="activemq.queue:name=queue1">
| <attribute name="JNDIName">queue/queue1</attribute>
|
| <depends
optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra-4.0.1.rar'</depends>
| <attribute name="Type">javax.jms.Queue</attribute>
| <attribute
name="Properties">PhysicalName=queue.queue1</attribute>
| </mbean>
|
I fiddled around with some other configs too but it'll make my post too long if I show
all those...
I'm clearly missing a link somewhere because after all these changes I am getting:
java.lang.ClassCastException
| at org.jboss.mq.SpyQueueReceiver.<init>(SpyQueueReceiver.java:42)
| at org.jboss.mq.SpySession.createReceiver(SpySession.java:689)
|
whenever I try to create a receiver (and I think its the same for creating a sender too)
Thanks again...
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961500#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...