[jboss-user] [JBossMQ] - Connecting a remote queue (oc4j server) in JBoss
romain3396
do-not-reply at jboss.com
Thu Mar 5 16:23:53 EST 2009
Dear all,
I've created a queue in oc4j, I can post and read messages and receive it via a Java Client.
Now I want to create a MDB in Jboss to consume these messages.
I've followed this Jboss tutorial
http://www.jboss.org/community/docs/DOC-9893/version/5
All is deployed, but the messages are not consumed : no logs, no exceptions...
I don't understand 1 thing : in these examples, I've not documented the JNDI of the oc4j queue, how can I set it ? (queue/myqueue)
In the jms.ds-xml of Jboss, I've created
<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
| name="jboss.mq:service=JMSProviderLoader,name=RemoteJBossMQProvider">
| <attribute name="ProviderName">RosyStatJMSProvider</attribute>
| <attribute name="ProviderAdapterClass">
| org.jboss.jms.jndi.JNDIProviderAdapter
| </attribute>
| <attribute name="FactoryRef">XAConnectionFactory</attribute>
| <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
| <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
| <attribute name="Properties">
| java.naming.factory.initial=com.evermind.server.rmi.RMIInitialContextFactory
| java.naming.provider.url=ormi://myoc4jserver:12502/
| java.naming.security.principal=login
| java.naming.security.credentials=password
| </attribute>
| </mbean>
|
And this is the Jboss.xml of my MDB
<?xml version="1.0" encoding="UTF-8"?>
| <jboss>
| <enterprise-beans>
| <message-driven>
| <ejb-name>MyMDB</ejb-name>
| <destination-jndi-name>queue/MDBReceiveQueue</destination-jndi-name>
| <invoker-bindings>
| <invoker>
| <invoker-proxy-binding-name>whatever-message-driven-bean</invoker-proxy-binding-name>
| </invoker>
| </invoker-bindings>
| </message-driven>
| </enterprise-beans>
|
| <invoker-proxy-bindings>
| <name>whatever-message-driven-bean</name>
| <proxy-factory-config>
| <JMSProviderAdapterJNDI>java://RosyStatJMSProvider</JMSProviderAdapterJNDI>
| <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
| <MaximumSize>15</MaximumSize>
| <MaxMessages>1</MaxMessages>
| <MDBConfig>
| <ReconnectIntervalSec>10</ReconnectIntervalSec>
| <DLQConfig>
| <DestinationQueue>queue/DLQ</DestinationQueue>
| <MaxTimesRedelivered>10</MaxTimesRedelivered>
| <TimeToLive>0</TimeToLive>
| </DLQConfig>
| </MDBConfig>
| </proxy-factory-config>
|
| </invoker-proxy-bindings>
| </jboss>
Here is my client which connects to the oc4j server (and works)
Properties properties = new Properties();
| try {
| properties.load(new FileInputStream(config));
| } catch (Exception e) {
| throw new RuntimeException("Error while reading property file.", e);
| }
| Context ctx;
|
| try {
| Properties parm = new Properties();
|
| parm.setProperty("java.naming.factory.initial",
| "com.evermind.server.rmi.RMIInitialContextFactory");
| parm.setProperty("java.naming.provider.url", "ormi://myoc4jserver:12502");
| parm.setProperty("java.naming.security.principal", "login");
| parm.setProperty("java.naming.security.credentials", "password");
|
| ctx = new InitialContext(parm);
|
| QueueConnectionFactory connectionFactory = (QueueConnectionFactory) ctx
| .lookup("jms/QueueConnectionFactory");
|
| connection = connectionFactory.createQueueConnection();
| connection.start();
| session = connection.createQueueSession(false,
| Session.AUTO_ACKNOWLEDGE);
| queue = (Queue) ctx.lookup(properties.getProperty("queue/myqueue"));
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215481#4215481
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215481
More information about the jboss-user
mailing list