Hi,
I am hoping to get some answer from this list(finger
crossed). My question is; How to redirect message to default DLQ?.
DLQ here is the one which is created by jBoss when we start
it as ‘run.bat –b 0.0.0.0 –c all’ [Note: I want it to
use cluster setup] along with some other queues called A,B,C,D… with two
of my queues like RequestQueue and ResponseQueue. When My MDB fail to post
message to server it gives an exception where I think by default the message
resides in RequestQueue should get redirected to DLQ [jndi: queue/DLQ] where
one other MDB is waiting and post message to some other instance of my server.
I have deployed following in my ‘<Jboss_Home>/server/all/deploy’
directory;
1)
BrowserWeb.war ą Successfully deployed web application
which is putting message on queue and fetching messages back from reply queue.
2)
Jremote-ra.rar ą Successfully deployed resource adapter
which provides connectivity to the database server on port ‘20005’
using first connection factory in ‘server-ds.xml’. If database
server service goes down on port 20005 my primary MDB will give
an exception here message should get redirected to jBoss default DLQ and
my backup MDB_DLQ should read message from DLQ and will try to
use second connection factory which will try to connect on port ‘20003’
where my database server is alive.
Server-ds.xml (Deployment Descriptor uses above
resource adaptor)
<?xml version="1.0" encoding="utf-8"?>
<!--
================================================================================
-->
<!--
-->
<!-- JBoss Server
Configuration -->
<!--
-->
<!-- jRemote resource adapter
deployment for JBoss, configured for local connection -->
<!--
-->
<!--
================================================================================
-->
<connection-factories>
<tx-connection-factory>
<jndi-name>jca/t24ConnectionFactory</jndi-name>
<rar-name>jremote-ra.rar</rar-name>
<connection-definition>com.jbase.jremote.JConnectionFactory</connection-definition>
<config-property name="host" type="java.lang.String">10.44.5.138</config-property> -->
<config-property name="port" type="java.lang.Integer">20005</config-property>
<config-property name="allowInput" type="java.lang.Boolean">true</config-property>
<config-property name="compression" type="java.lang.Boolean">true</config-property>
<config-property name="compressionThreshold" type="java.lang.Integer">2048</config-property>
<!--pooling parameters-->
<min-pool-size>1</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>true</prefill>
</tx-connection-factory>
<tx-connection-factory>
<jndi-name>jca/t24ConnectionFactory_DLQ</jndi-name>
<rar-name>jremote-ra.rar</rar-name>
<connection-definition>com.jbase.jremote.JConnectionFactory</connection-definition>
<config-property name="host" type="java.lang.String">10.44.5.138</config-property> -->
<config-property name="port" type="java.lang.Integer">20003</config-property>
<config-property name="allowInput" type="java.lang.Boolean">true</config-property>
<config-property name="compression" type="java.lang.Boolean">true</config-property>
<config-property name="compressionThreshold" type="java.lang.Integer">2048</config-property>
<!--pooling parameters
<min-pool-size>1</min-pool-size>-->
<max-pool-size>10</max-pool-size>
<!--<prefill>true</prefill>-->
</tx-connection-factory>
</connection-factories>
Destination-service.xml (For JMS)
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id:
jbossmq-destinations-service.xml 25907 2004-11-16 04:32:39Z ejort $ -->
<!--
| This file defines the default
Queues and Topics that JBossMQ
| ships with. The default Queues and
Topics are used by the
| JBoss test suite and by the sample
jms programs.
|
| You can add other destinations to
this file, or you can create other
| *-service.xml files to contain your
application's destinations.
-->
<server>
<!-- Destination without a configured
SecurityManager or without a
a SecurityConf will default to
role guest with read=true, write=true,
create=false.
-->
<mbean code="org.jboss.mq.server.jmx.Queue"
name="jboss.mq.destination:service=Queue,name=t24OFSQueue">
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
name="jboss.mq.destination:service=Queue,name=t24OFSReplyQueue">
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
</mbean>
</server>
MDB is a jar file contains following xml in META-INF
Ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="EJBJar_OfsMessageMDB" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<display-name>OFSMessage</display-name>
<enterprise-beans>
<message-driven id="MessageDriven_OfsMessageMDB"> <!—-
Simple message driven bean-->
<display-name>OFSMessage Bean</display-name>
<ejb-name>OFSMessageMDB</ejb-name>
<ejb-class>com.temenos.ofsmessage.mdb.OFSMessageMDB</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Bean</transaction-type>
<message-destination-type>javax.jms.Queue</message-destination-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>Auto-acknowledge</activation-config-property-value>
</activation-config-property>
</activation-config>
<resource-ref id="ResourceRef_jmsQueueConnectionFactory">
<description>T24 Queue Connection Factory</description>
<res-ref-name>jms/jmsConnectionFactory</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref id="ResourceRef_t24ConnectionFactory">
<description>T24 JCA Connection Factory</description>
<res-ref-name>jca/t24ConnectionFactory</res-ref-name>
<res-type>com.jbase.jremote.JConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref id="ResourceRef_t24OFSReplyQueue">
<description>OFS reply queue</description>
<res-ref-name>queue/t24OFSReplyQueue</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</message-driven>
<message-driven id="MessageDriven_OfsMessageMDB_DLQ">
<display-name>OFSMessage Bean DLQ</display-name> <!—-DLQ
message driven bean-->
<ejb-name>OFSMessageMDB_DLQ</ejb-name>
<ejb-class>com.temenos.ofsmessage.mdb.OFSMessageMDB</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Bean</transaction-type>
<message-destination-type>javax.jms.Queue</message-destination-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>Auto-acknowledge</activation-config-property-value>
</activation-config-property>
</activation-config>
<resource-ref id="ResourceRef_jmsQueueConnectionFactory_DLQ">
<description>T24 Queue Connection Factory</description>
<res-ref-name>jms/jmsConnectionFactory</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref id="ResourceRef_t24ConnectionFactory_DLQ">
<description>T24 JCA Connection Factory</description>
<res-ref-name>jca/t24ConnectionFactory</res-ref-name>
<res-type>com.jbase.jremote.JConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref id="ResourceRef_t24OFSReplyQueue_DLQ">
<description>OFS reply queue</description>
<res-ref-name>queue/t24OFSReplyQueue</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</message-driven>
</enterprise-beans>
</ejb-jar>
Jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
<jboss>
<enterprise-beans>
<message-driven>
<ejb-name>OFSMessageMDB</ejb-name>
<destination-jndi-name>queue/t24OFSQueue</destination-jndi-name>
<resource-ref>
<res-ref-name>jms/jmsConnectionFactory</res-ref-name>
<jndi-name>java:/ConnectionFactory</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>queue/t24OFSReplyQueue</res-ref-name>
<!--
<res-type>javax.jms.Queue</res-type>
-->
<jndi-name>queue/t24OFSReplyQueue</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>jca/t24ConnectionFactory</res-ref-name>
<jndi-name>java:jca/t24ConnectionFactory</jndi-name>
<!--
<res-type>com.jbase.jremote.JConnectionFactory</res-type>
-->
</resource-ref>
</message-driven>
<message-driven>
<ejb-name>OFSMessageMDB_DLQ</ejb-name>
<destination-jndi-name>queue/DLQ</destination-jndi-name> <!—Default
DL Queue Refrenece -->
<resource-ref>
<res-ref-name>jms/jmsConnectionFactory</res-ref-name>
<jndi-name>java:/ConnectionFactory</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>queue/t24OFSReplyQueue</res-ref-name>
<!--<res-type>javax.jms.Queue</res-type>-->
<jndi-name>queue/t24OFSReplyQueue</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>jca/t24ConnectionFactory</res-ref-name>
<jndi-name>java:jca/t24ConnectionFactory_DLQ</jndi-name>
<!--<res-type>com.jbase.jremote.JConnectionFactory</res-type>-->
</resource-ref>
</message-driven>
</enterprise-beans>
</jboss>
Is Something missing in here because I can not see any
message redirection to DLQ. If you require any other information about my setup
please let me know. Your response and help will be appreciated.
Regards,
--
Sheeraz Junejo