Hi
I'm trying to use SonicMQ as the JMS provider in JBoss 4.0.3. I have an MDB
that listens to a queue existing on SonicMQ. The MDB is able to receive the
message correctly. However, when I shutdown the JBoss then the messages that
the MDB had consumed reappear on the SonicMQ. Below are the relevant portions
from the configuration files.
I'm not able to figure out what am I missing in setting up the JMS provider.
Any help would be greatly appreciated.
Regards.
MDB class:
| package test;
|
| import javax.ejb.MessageDrivenBean;
| import javax.ejb.MessageDrivenContext;
| import javax.ejb.EJBException;
| import javax.jms.MessageListener;
| import javax.jms.Message;
| import javax.jms.TextMessage;
| import javax.jms.JMSException;
|
| public class JBossMDB implements MessageDrivenBean, MessageListener {
|
| private MessageDrivenContext ctx;
| public void setMessageDrivenContext(MessageDrivenContext
messageDrivenContext) throws EJBException {
| ctx = messageDrivenContext;
| }
|
| public void ejbCreate() throws EJBException {
| System.out.println("Created MDB. ");
| }
| public void ejbRemove() throws EJBException {
| System.out.println("Removed MDB. ");
| }
|
| public void onMessage(Message message) {
|
| if (message instanceof TextMessage) {
| try {
| String msg = ((TextMessage)message).getText();
| System.out.println("Message: "+msg);
| } catch (JMSException e) {
| e.printStackTrace();
| }
| } else {
| System.out.println("Non-text message received! ");
| }
| }
| }
|
|
META-INF/jboss.xml:
| <jboss>
| <enterprise-beans>
| <message-driven>
| <ejb-name>JBossMDB</ejb-name>
|
<destination-jndi-name>queue/test-in-queue</destination-jndi-name>
| <invoker-bindings>
| <invoker>
|
<invoker-proxy-binding-name>message-driven-bean</invoker-proxy-binding-name>
| </invoker>
| </invoker-bindings>
| </message-driven>
| </enterprise-beans>
| </jboss>
META-INF/ejb-jar.xml:
| <ejb-jar>
| <enterprise-beans>
| <message-driven>
| <ejb-name>JBossMDB</ejb-name>
| <ejb-class>test.JBossMDB</ejb-class>
| <transaction-type>Container</transaction-type>
| <message-driven-destination>
| <destination-type>javax.jms.Queue</destination-type>
| </message-driven-destination>
| </message-driven>
| </enterprise-beans>
| <assembly-descriptor>
| <container-transaction>
| <method>
| <ejb-name>JBossMDB</ejb-name>
| <method-name>*</method-name>
| </method>
| <trans-attribute>NotSupported</trans-attribute>
| </container-transaction>
| </assembly-descriptor>
| </ejb-jar>
|
/server/myInstance/conf/sonicloader-conf.xml:
| <sonicloader xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="file://d:\atProjects\JBossProvider\sonicloader.xsd">
| <jndiEnvironment>
| <property
name="java.naming.provider.url">jnp://localhost:1099</property>
| <property
name="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</property>
| <property
name="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</property>
| <property name="java.naming.referral">throw</property>
| </jndiEnvironment>
| <entities>
|
| <entity jndiName="sonicqcf"
class="progress.message.jclient.xa.XAQueueConnectionFactory">
| <property
name="brokerURL">tcp://localhost:2506</property>
| <property
name="connectionURLs">tcp://localhost:2506</property>
| <property name="defaultUser">admin</property>
| <property name="defaultPassword">admin</property>
| <property name="prefetchCount">3</property>
| <property name="prefetchThreshold">1</property>
| <property name="sequential">true</property>
| </entity>
| <!-- Destinations -->
| <!-- Make sure you create the queues on the message broker -->
| <entity jndiName="queue/SonicDLQ"
class="progress.message.jclient.Queue">
| <property
name="queueName">SonicMQ.deadMessage</property>
| </entity>
|
| <entity jndiName="queue/test-in-queue"
class="progress.message.jclient.Queue">
| <property name="queueName">test.in.queue</property>
| </entity>
|
| </entities>
| </sonicloader>
|
sonicmq-service.xml:
| <server>
| <mbean code="com.sonicsw.pso.jndiloader.jboss.JBossLoader"
name="sonic.mq:service=JNDILoader">
| <attribute
name="LoaderConfigURL">file:///C:/etc/jboss-4.0.3/server/myInstance/conf/sonicloader-conf.xml</attribute>
| <depends>jboss:service=Naming</depends>
| </mbean>
| <!-- The JMS provider loader -->
| <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
| name="jboss.mq:service=JMSProviderLoader,name=SonicJBossMQProvider">
| <attribute name="ProviderName">SonicJMSProvider</attribute>
| <attribute name="ProviderAdapterClass">
| org.jboss.jms.jndi.JNDIProviderAdapter
| </attribute>
| <attribute name="QueueFactoryRef">sonicqcf</attribute>
| <attribute name="TopicFactoryRef">sonicqcf</attribute>
| </mbean>
|
| <!-- The Sonic server session pool for Message Driven Beans -->
| <mbean code="org.jboss.jms.asf.ServerSessionPoolLoader"
| name="jboss.mq:service=ServerSessionPoolMBean,name=SonicStdJMSPool">
| <depends
optional-attribute-name="XidFactory">jboss:service=XidFactory</depends>
| <attribute name="PoolName">SonicStdJMSPool</attribute>
| <attribute name="PoolFactoryClass">
| com.sonicsw.pso.jboss.v1.SonicMQServerSessionPoolFactory
| </attribute>
| </mbean>
| </server>
|
conf/standardjboss.xml:
| <invoker-proxy-binding>
| <name>message-driven-bean</name>
| <invoker-mbean>default</invoker-mbean>
|
<proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
| <proxy-factory-config>
| <JMSProviderAdapterJNDI>SonicJMSProvider</JMSProviderAdapterJNDI>
|
<ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
| <CreateJBossMQDestination>true</CreateJBossMQDestination>
| <!-- WARN: Don't set this to zero until a bug in the pooled
executor is fixed -->
| <MinimumSize>1</MinimumSize>
| <MaximumSize>15</MaximumSize>
| <KeepAliveMillis>30000</KeepAliveMillis>
| <MaxMessages>1</MaxMessages>
| <MDBConfig>
| <ReconnectIntervalSec>10</ReconnectIntervalSec>
| <DLQConfig>
| <DestinationQueue>queue/SonicDLQ</DestinationQueue>
| <MaxTimesRedelivered>10</MaxTimesRedelivered>
| <TimeToLive>0</TimeToLive>
| </DLQConfig>
| </MDBConfig>
| </proxy-factory-config>
| </invoker-proxy-binding>
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3903094#3903094
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3903094
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user