[hornetq-commits] JBoss hornetq SVN: r10252 - in branches/Branch_2_2_EAP/examples/javaee: mdb-remote-failover and 11 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Feb 25 02:52:03 EST 2011


Author: ataylor
Date: 2011-02-25 02:52:02 -0500 (Fri, 25 Feb 2011)
New Revision: 10252

Added:
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/backup-server/
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/backup-server/hornetq-configuration.xml
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/backup-server/hornetq-jms.xml
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/build.bat
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/build.sh
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/build.xml
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/META-INF/
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/META-INF/application.xml
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/ant.properties
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/jndi.properties
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/live-server/
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/live-server/hornetq-configuration.xml
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/live-server/hornetq-jms.xml
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/hornetq-configuration.xml
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/hornetq-jms.xml
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/jms-ds.xml
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/ra.xml
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/hornetq/
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/hornetq/javaee/
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/hornetq/javaee/example/
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/hornetq/javaee/example/MDBRemoteFailoverClientExample.java
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/hornetq/javaee/example/server/
   branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/hornetq/javaee/example/server/MDBRemoteFailoverExample.java
Log:
added MDB failover example

Added: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/backup-server/hornetq-configuration.xml
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/backup-server/hornetq-configuration.xml	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/backup-server/hornetq-configuration.xml	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,108 @@
+<!--
+  ~ Copyright 2009 Red Hat, Inc.
+  ~  Red Hat licenses this file to you under the Apache License, version
+  ~  2.0 (the "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  ~  implied.  See the License for the specific language governing
+  ~  permissions and limitations under the License.
+  -->
+
+<configuration xmlns="urn:hornetq"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+
+   <name>HornetQ.main.config</name>
+
+   <clustered>true</clustered>
+
+   <failover-on-shutdown>true</failover-on-shutdown>
+
+   <backup>true</backup>
+
+   <shared-store>true</shared-store>
+
+   <!--journal directories-->
+   <large-messages-directory>/tmp/shared/hornetq-data/large-messages</large-messages-directory>
+   <bindings-directory>/tmp/shared/hornetq-data/bindings</bindings-directory>
+   <journal-directory>/tmp/shared/hornetq-data/journal</journal-directory>
+   <paging-directory>/tmp/shared/hornetq-data/paging</paging-directory>
+
+   <!-- Connectors -->
+
+   <connectors>
+      <connector name="netty-connector">
+         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+         <param key="host"  value="${jboss.bind.address:localhost}"/>
+         <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
+      </connector>
+      <connector name="in-vm">
+         <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
+         <param key="server-id" value="${hornetq.server-id:0}"/>
+      </connector>
+   </connectors>      
+
+   <!-- Acceptors -->
+   <acceptors>
+      <!-- In VM acceptor -->
+      <acceptor name="in-vm">
+         <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
+         <param key="server-id" value="${hornetq.server-id:0}"/>
+      </acceptor>
+      <acceptor name="netty-acceptor">
+         <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+         <param key="host"  value="${jboss.bind.address:localhost}"/>
+         <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
+      </acceptor>
+   </acceptors>
+
+    <broadcast-groups>
+		<broadcast-group name="bg-group1">
+			<group-address>231.7.7.7</group-address>
+			<group-port>9876</group-port>
+			<broadcast-period>1000</broadcast-period>
+         <connector-ref>netty-connector</connector-ref>
+		</broadcast-group>
+	</broadcast-groups>
+
+	<discovery-groups>
+		<discovery-group name="dg-group1">
+			<group-address>231.7.7.7</group-address>
+			<group-port>9876</group-port>
+			<refresh-timeout>60000</refresh-timeout>
+		</discovery-group>
+	</discovery-groups>
+
+	<cluster-connections>
+		<cluster-connection name="my-cluster">
+			<address>jms</address>
+         <connector-ref>netty-connector</connector-ref>
+			<discovery-group-ref discovery-group-name="dg-group1"/>
+		</cluster-connection>
+	</cluster-connections>
+   <!-- Other config -->
+
+   <security-settings>
+      <!--security for example queue-->
+      <security-setting match="jms.queue.inQueue">
+         <permission type="createDurableQueue" roles="guest"/>
+         <permission type="deleteDurableQueue" roles="guest"/>
+         <permission type="createNonDurableQueue" roles="guest"/>
+         <permission type="deleteNonDurableQueue" roles="guest"/>
+         <permission type="consume" roles="guest"/>
+         <permission type="send" roles="guest"/>
+      </security-setting>
+      <security-setting match="jms.queue.outQueue">
+         <permission type="createDurableQueue" roles="guest"/>
+         <permission type="deleteDurableQueue" roles="guest"/>
+         <permission type="createNonDurableQueue" roles="guest"/>
+         <permission type="deleteNonDurableQueue" roles="guest"/>
+         <permission type="consume" roles="guest"/>
+         <permission type="send" roles="guest"/>
+      </security-setting>
+   </security-settings>
+
+</configuration>

Added: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/backup-server/hornetq-jms.xml
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/backup-server/hornetq-jms.xml	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/backup-server/hornetq-jms.xml	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,49 @@
+<!--
+  ~ Copyright 2009 Red Hat, Inc.
+  ~  Red Hat licenses this file to you under the Apache License, version
+  ~  2.0 (the "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  ~  implied.  See the License for the specific language governing
+  ~  permissions and limitations under the License.
+  -->
+
+<configuration xmlns="urn:hornetq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
+   <!--the connection factory used by the example-->
+   <connection-factory name="ConnectionFactory">
+      <connectors>
+         <connector-ref connector-name="netty-connector"/>
+      </connectors>
+
+      <entries>
+         <entry name="ConnectionFactory"/>
+      </entries>
+       
+       <ha>true</ha>
+      <!-- Pause 1 second between connect attempts -->
+      <retry-interval>1000</retry-interval>
+
+      <!-- Multiply subsequent reconnect pauses by this multiplier. This can be used to
+      implement an exponential back-off. For our purposes we just set to 1.0 so each reconnect
+      pause is the same length -->
+      <retry-interval-multiplier>1.0</retry-interval-multiplier>
+
+      <!-- Try reconnecting an unlimited number of times (-1 means "unlimited") -->
+      <reconnect-attempts>-1</reconnect-attempts>
+   </connection-factory>
+
+   <!--the queue used by the example-->
+   <queue name="inQueue">
+      <entry name="/queue/inQueue"/>
+   </queue>
+
+   <queue name="outQueue">
+      <entry name="/queue/outQueue"/>
+   </queue>
+
+</configuration>

Copied: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/build.bat (from rev 10233, branches/Branch_2_2_EAP/examples/javaee/jca-remote/build.bat)
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/build.bat	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/build.bat	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,13 @@
+ at echo off
+
+set "OVERRIDE_ANT_HOME=..\..\..\tools\ant"
+
+if exist "..\..\..\src\bin\build.bat" (
+   rem running from TRUNK
+   call ..\..\..\src\bin\build.bat %*
+) else (
+   rem running from the distro
+   call ..\..\..\bin\build.bat %*
+)
+
+set "OVERRIDE_ANT_HOME="

Copied: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/build.sh (from rev 10233, branches/Branch_2_2_EAP/examples/javaee/jca-remote/build.sh)
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/build.sh	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/build.sh	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+OVERRIDE_ANT_HOME=../../../tools/ant
+export OVERRIDE_ANT_HOME
+
+if [ -f "../../../src/bin/build.sh" ]; then
+   # running from TRUNK
+   ../../../src/bin/build.sh "$@"
+else
+   # running from the distro
+   ../../../bin/build.sh "$@"
+fi
+
+
+

Copied: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/build.xml (from rev 10233, branches/Branch_2_2_EAP/examples/javaee/jca-remote/build.xml)
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/build.xml	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/build.xml	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2009 Red Hat, Inc.
+  ~  Red Hat licenses this file to you under the Apache License, version
+  ~  2.0 (the "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  ~  implied.  See the License for the specific language governing
+  ~  permissions and limitations under the License.
+  -->
+
+<project default="run" name="HornetQ Java EE MDB with remote failover Config Example">
+
+   <import file="../common/build.xml"/>
+   <property file="../../common/config/server.properties"/>
+
+   <property name="example.live.server.dir" value="live-server"/>
+   <property name="example.backup.server.dir" value="backup-server"/>
+   <target name="run" depends="validate-jboss,compile">
+
+      <property name="serverclasspath" refid="jms.runtime.classpath"/>
+
+      <java classname="org.hornetq.javaee.example.MDBRemoteFailoverClientExample" fork="true">
+         <jvmarg value="-Dhornetq.example.server.classpath=${serverclasspath}"/>
+         <jvmarg value="-Dhornetq.example.server.args=${server.args}"/>
+         <jvmarg value="-Dhornetq.example.logserveroutput=${hornetq.example.logserveroutput}"/>
+         <jvmarg value="-Dhornetq.example.runServer=${hornetq.example.runServer}"/>
+         <arg line="${hornetq.example.beans.file}"/>
+         <sysproperty key="java.library.path" value="${java.library.path}${path.separator}${aio.library.path}"/>
+         <classpath refid="jms.runtime.classpath"/>
+      </java>
+   </target>
+
+
+   <target name="copy-resources">
+      <copy todir="${example-profile}/deploy/jms-ra.rar/META-INF" overwrite="true">
+         <fileset dir="${example.server.dir}">
+            <include  name="ra.xml"/>
+         </fileset>
+      </copy>
+   </target>
+
+   <target name="deployLive" depends="validate-jboss, copy-live-profile">
+      <property name="example-profile" value="${jboss.home}/server/${example.name}-live"/>
+      <copy todir="${example-profile}/deploy/hornetq" overwrite="true">
+         <fileset dir="${example.live.server.dir}"/>
+      </copy>
+      <exec dir="${jboss.home}/bin" executable="sh" osfamily="unix">
+         <arg line="run.sh -Djboss.service.binding.set=ports-01 -c ${example.name}-live"/>
+      </exec>
+      <exec dir="${jboss.home}/bin" executable="cmd" osfamily="windows">
+         <arg line="/c run.bat -Djboss.service.binding.set=ports-01 -c ${example.name}-live"/>
+      </exec>
+   </target>
+
+   <target name="copy-live-profile" depends="live.profile.check" unless="donot.copy.profile">
+      <property name="profile" value="${jboss.home}/server/default"/>
+      <property name="example-profile" value="${jboss.home}/server/${example.name}-live"/>
+      <property name="deploy.dir" value="${example-profile}/deploy/"/>
+      <mkdir dir="${example-profile}"/>
+      <copy todir="${example-profile}">
+         <fileset dir="${profile}">
+            <exclude name="**/*hornetq-configuration.xml"/>
+            <exclude name="**/*hornetq-jms.xml"/>
+         </fileset>
+      </copy>
+   </target>
+
+   <target name="live.profile.check">
+      <property name="example-profile" value="${jboss.home}/server/${example.name}-live"/>
+      <condition property="donot.copy.profile">
+         <available  file="${example-profile}" type="dir"/>
+      </condition>
+   </target>
+
+      <target name="deployBackup" depends="validate-jboss, copy-backup-profile">
+      <property name="example-profile" value="${jboss.home}/server/${example.name}-backup"/>
+      <copy todir="${example-profile}/deploy/hornetq" overwrite="true">
+         <fileset dir="${example.backup.server.dir}"/>
+      </copy>
+      <exec dir="${jboss.home}/bin" executable="sh" osfamily="unix">
+         <arg line="run.sh -Djboss.service.binding.set=ports-02 -c ${example.name}-backup"/>
+      </exec>
+      <exec dir="${jboss.home}/bin" executable="cmd" osfamily="windows">
+         <arg line="/c run.bat -Djboss.service.binding.set=ports-02 -c ${example.name}-backup"/>
+      </exec>
+   </target>
+
+   <target name="copy-backup-profile" depends="backup.profile.check" unless="donot.copy.profile">
+      <property name="profile" value="${jboss.home}/server/default"/>
+      <property name="example-profile" value="${jboss.home}/server/${example.name}-backup"/>
+      <property name="deploy.dir" value="${example-profile}/deploy/"/>
+      <mkdir dir="${example-profile}"/>
+      <copy todir="${example-profile}">
+         <fileset dir="${profile}">
+            <exclude name="**/*hornetq-configuration.xml"/>
+         </fileset>
+      </copy>
+   </target>
+
+   <target name="backup.profile.check">
+      <property name="example-profile" value="${jboss.home}/server/${example.name}-backup"/>
+      <condition property="donot.copy.profile">
+         <available  file="${example-profile}" type="dir"/>
+      </condition>
+   </target>
+
+</project>
\ No newline at end of file

Copied: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/META-INF/application.xml (from rev 10233, branches/Branch_2_2_EAP/examples/javaee/jca-remote/config/META-INF/application.xml)
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/META-INF/application.xml	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/META-INF/application.xml	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,28 @@
+<!--
+  ~ Copyright 2009 Red Hat, Inc.
+  ~  Red Hat licenses this file to you under the Apache License, version
+  ~  2.0 (the "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  ~  implied.  See the License for the specific language governing
+  ~  permissions and limitations under the License.
+  -->
+
+<application>
+  <display-name>My Application</display-name>
+
+  <module>
+    <web>
+      <web-uri>mdb-remote-failover-example.war</web-uri>
+      <context-root>/hornetq</context-root>
+    </web>
+  </module>
+   <module>
+      <java>mdb-remote-failover-example.jar</java>
+   </module>
+
+
+</application>

Copied: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/ant.properties (from rev 10233, branches/Branch_2_2_EAP/examples/javaee/jca-remote/config/ant.properties)
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/ant.properties	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/ant.properties	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,14 @@
+#
+# Copyright 2009 Red Hat, Inc.
+#  Red Hat licenses this file to you under the Apache License, version
+#  2.0 (the "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#     http://www.apache.org/licenses/LICENSE-2.0
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+#  implied.  See the License for the specific language governing
+#  permissions and limitations under the License.
+#
+
+example.name=mdb-remote-failover
\ No newline at end of file

Copied: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/jndi.properties (from rev 10233, branches/Branch_2_2_EAP/examples/javaee/jca-remote/config/client.jndi.properties)
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/jndi.properties	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/config/jndi.properties	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,16 @@
+#
+# Copyright 2009 Red Hat, Inc.
+#  Red Hat licenses this file to you under the Apache License, version
+#  2.0 (the "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#     http://www.apache.org/licenses/LICENSE-2.0
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+#  implied.  See the License for the specific language governing
+#  permissions and limitations under the License.
+#
+
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1199
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Copied: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/live-server/hornetq-configuration.xml (from rev 10233, branches/Branch_2_2_EAP/examples/jms/non-transaction-failover/server0/hornetq-configuration.xml)
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/live-server/hornetq-configuration.xml	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/live-server/hornetq-configuration.xml	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,109 @@
+<!--
+  ~ Copyright 2009 Red Hat, Inc.
+  ~  Red Hat licenses this file to you under the Apache License, version
+  ~  2.0 (the "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  ~  implied.  See the License for the specific language governing
+  ~  permissions and limitations under the License.
+  -->
+
+<configuration xmlns="urn:hornetq"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+
+   <name>HornetQ.main.config</name>
+
+   <clustered>true</clustered>
+
+   <!--we shutdown the server process so need this set to true-->
+   <failover-on-shutdown>true</failover-on-shutdown>
+
+   <shared-store>true</shared-store>
+
+   <!--journal directories-->
+   <large-messages-directory>/tmp/shared/hornetq-data/large-messages</large-messages-directory>
+   <bindings-directory>/tmp/shared/hornetq-data/bindings</bindings-directory>
+   <journal-directory>/tmp/shared/hornetq-data/journal</journal-directory>
+   <paging-directory>/tmp/shared/hornetq-data/paging</paging-directory>
+
+   <!-- Connectors -->
+
+   <connectors>
+      <connector name="netty-connector">
+         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+         <param key="host"  value="${jboss.bind.address:localhost}"/>
+         <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
+      </connector>
+
+      <connector name="in-vm">
+         <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
+         <param key="server-id" value="${hornetq.server-id:0}"/>
+      </connector>
+   </connectors>      
+
+   <!-- Acceptors -->
+   <acceptors>
+
+      <!-- In VM acceptor -->
+      <acceptor name="in-vm">
+         <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
+         <param key="server-id" value="${hornetq.server-id:0}"/>
+      </acceptor>
+      <acceptor name="netty-acceptor">
+         <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+         <param key="host"  value="${jboss.bind.address:localhost}"/>
+         <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
+      </acceptor>
+   </acceptors>
+
+    <broadcast-groups>
+		<broadcast-group name="bg-group1">
+			<group-address>231.7.7.7</group-address>
+			<group-port>9876</group-port>
+			<broadcast-period>1000</broadcast-period>
+         <connector-ref>netty-connector</connector-ref>
+		</broadcast-group>
+	</broadcast-groups>
+
+	<discovery-groups>
+		<discovery-group name="dg-group1">
+			<group-address>231.7.7.7</group-address>
+			<group-port>9876</group-port>
+			<refresh-timeout>60000</refresh-timeout>
+		</discovery-group>
+	</discovery-groups>
+
+	<cluster-connections>
+		<cluster-connection name="my-cluster">
+			<address>jms</address>
+         <connector-ref>netty-connector</connector-ref>
+			<discovery-group-ref discovery-group-name="dg-group1"/>
+		</cluster-connection>
+	</cluster-connections>
+   <!-- Other config -->
+
+   <security-settings>
+      <!--security for example queue-->
+      <security-setting match="jms.queue.inQueue">
+         <permission type="createDurableQueue" roles="guest"/>
+         <permission type="deleteDurableQueue" roles="guest"/>
+         <permission type="createNonDurableQueue" roles="guest"/>
+         <permission type="deleteNonDurableQueue" roles="guest"/>
+         <permission type="consume" roles="guest"/>
+         <permission type="send" roles="guest"/>
+      </security-setting>
+      <security-setting match="jms.queue.outQueue">
+         <permission type="createDurableQueue" roles="guest"/>
+         <permission type="deleteDurableQueue" roles="guest"/>
+         <permission type="createNonDurableQueue" roles="guest"/>
+         <permission type="deleteNonDurableQueue" roles="guest"/>
+         <permission type="consume" roles="guest"/>
+         <permission type="send" roles="guest"/>
+      </security-setting>
+   </security-settings>
+
+</configuration>

Copied: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/live-server/hornetq-jms.xml (from rev 10233, branches/Branch_2_2_EAP/examples/jms/non-transaction-failover/server0/hornetq-jms.xml)
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/live-server/hornetq-jms.xml	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/live-server/hornetq-jms.xml	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,49 @@
+<!--
+  ~ Copyright 2009 Red Hat, Inc.
+  ~  Red Hat licenses this file to you under the Apache License, version
+  ~  2.0 (the "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  ~  implied.  See the License for the specific language governing
+  ~  permissions and limitations under the License.
+  -->
+
+<configuration xmlns="urn:hornetq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
+   <!--the connection factory used by the example-->
+   <connection-factory name="ConnectionFactory">
+      <connectors>
+         <connector-ref connector-name="netty-connector"/>
+      </connectors>
+
+      <entries>
+         <entry name="ConnectionFactory"/>
+      </entries>
+       
+       <ha>true</ha>
+      <!-- Pause 1 second between connect attempts -->
+      <retry-interval>1000</retry-interval>
+
+      <!-- Multiply subsequent reconnect pauses by this multiplier. This can be used to
+      implement an exponential back-off. For our purposes we just set to 1.0 so each reconnect
+      pause is the same length -->
+      <retry-interval-multiplier>1.0</retry-interval-multiplier>
+
+      <!-- Try reconnecting an unlimited number of times (-1 means "unlimited") -->
+      <reconnect-attempts>-1</reconnect-attempts>
+   </connection-factory>
+
+   <!--the queue used by the example-->
+   <queue name="inQueue">
+      <entry name="/queue/inQueue"/>
+   </queue>
+
+   <queue name="outQueue">
+      <entry name="/queue/outQueue"/>
+   </queue>
+
+</configuration>

Copied: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/hornetq-configuration.xml (from rev 10233, branches/Branch_2_2_EAP/examples/javaee/jca-remote/server/hornetq-configuration.xml)
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/hornetq-configuration.xml	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/hornetq-configuration.xml	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,63 @@
+<!--
+  ~ Copyright 2009 Red Hat, Inc.
+  ~  Red Hat licenses this file to you under the Apache License, version
+  ~  2.0 (the "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  ~  implied.  See the License for the specific language governing
+  ~  permissions and limitations under the License.
+  -->
+
+<configuration xmlns="urn:hornetq"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+
+   <name>HornetQ.main.config</name>
+
+   <bindings-directory>${jboss.server.data.dir}/messaging/bindings</bindings-directory>
+
+   <journal-directory>${jboss.server.data.dir}/messaging/journal</journal-directory>
+
+   <large-messages-directory>${jboss.server.data.dir}/messaging/largemessages</large-messages-directory>
+
+   <paging-directory>${jboss.server.data.dir}/messaging/paging</paging-directory>
+
+   <!-- Connectors -->
+   <connectors>
+      <connector name="netty">
+         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+      </connector>
+
+      <connector name="in-vm">
+         <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
+      </connector>
+
+   </connectors>
+
+   <!-- Acceptors -->
+   <acceptors>
+      <!-- In VM acceptor -->
+      <acceptor name="in-vm">
+         <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
+         <param key="server-id" value="0"/>
+      </acceptor>
+
+      <!-- Netty TCP Acceptor -->
+      <acceptor name="netty">
+         <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+         <param key="port" value="${hornetq.remoting.netty.port:5445}"/>
+      </acceptor>
+   </acceptors>
+
+   <security-settings>
+      <security-setting match="jms.queue.#">
+         <permission type="consume" roles="guest,publisher"/>
+         <permission type="send" roles="guest,publisher"/>
+      </security-setting>
+   </security-settings>
+
+
+</configuration>

Copied: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/hornetq-jms.xml (from rev 10233, branches/Branch_2_2_EAP/examples/javaee/jca-remote/server/hornetq-jms.xml)
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/hornetq-jms.xml	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/hornetq-jms.xml	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,33 @@
+<!--
+  ~ Copyright 2009 Red Hat, Inc.
+  ~  Red Hat licenses this file to you under the Apache License, version
+  ~  2.0 (the "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  ~  implied.  See the License for the specific language governing
+  ~  permissions and limitations under the License.
+  -->
+
+<configuration xmlns="urn:hornetq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
+   <connection-factory name="ConnectionFactory">
+      <connectors>
+         <connector-ref connector-name="netty"/>
+      </connectors>
+      <entries>
+         <entry name="ConnectionFactory"/>
+         <entry name="XAConnectionFactory"/>
+      </entries>
+   </connection-factory>
+
+   <queue name="A">
+      <entry name="/queue/A"/>
+   </queue>
+   <queue name="B">
+      <entry name="/queue/B"/>
+   </queue>
+</configuration>
\ No newline at end of file

Copied: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/jms-ds.xml (from rev 10233, branches/Branch_2_2_EAP/examples/javaee/jca-remote/server/jms-ds.xml)
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/jms-ds.xml	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/jms-ds.xml	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<!--
+  ~ Copyright 2009 Red Hat, Inc.
+  ~  Red Hat licenses this file to you under the Apache License, version
+  ~  2.0 (the "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  ~  implied.  See the License for the specific language governing
+  ~  permissions and limitations under the License.
+  -->
+
+
+<!-- This file will be deployed by the target deploy on build.xml -->
+<connection-factories>
+
+
+   <!--
+    JMS XA Resource adapter, use this for outbound JMS connections.
+    Inbound connections are defined at the @MDB activaction or at the resource-adapter properties.
+   -->
+   <tx-connection-factory>
+      <jndi-name>RemoteJmsXA</jndi-name>
+      <xa-transaction/>
+      <rar-name>hornetq-ra.rar</rar-name>
+      <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory</connection-definition>
+      <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
+      <config-property name="hA" type="java.lang.Boolean">true</config-property>
+   </tx-connection-factory>
+  
+  
+</connection-factories>

Copied: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/ra.xml (from rev 10233, branches/Branch_2_2_EAP/examples/javaee/jca-remote/server/ra.xml)
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/ra.xml	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/server/ra.xml	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Copyright 2009 Red Hat, Inc.
+  ~  Red Hat licenses this file to you under the Apache License, version
+  ~  2.0 (the "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+  ~  implied.  See the License for the specific language governing
+  ~  permissions and limitations under the License.
+  -->
+
+<!-- This file will be installed by the example mdb-remote/build.xml, deploy target.
+     This is an example of how you could change the default configuration of a resource adapter
+ -->
+
+<connector 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/connector_1_5.xsd"
+           version="1.5">
+
+   <description>HornetQ 2.0 Resource Adapter Alternate Configuration</description>
+   <display-name>HornetQ 2.0 Resource Adapter Alternate Configuration</display-name>
+
+   <vendor-name>Red Hat Middleware LLC</vendor-name>
+   <eis-type>JMS 1.1 Server</eis-type>
+   <resourceadapter-version>1.0</resourceadapter-version>
+
+   <license>
+      <description>
+Copyright 2009 Red Hat, Inc.
+ Red Hat licenses this file to you under the Apache License, version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+   http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.  See the License for the specific language governing
+ permissions and limitations under the License.  
+      </description>
+      <license-required>true</license-required>
+   </license>
+
+   <resourceadapter>
+      <resourceadapter-class>org.hornetq.ra.HornetQResourceAdapter</resourceadapter-class>
+      <config-property>
+         <description>The Discovery Address</description>
+         <config-property-name>discoveryAddress</config-property-name>
+         <config-property-type>java.lang.String</config-property-type>
+         <config-property-value>231.7.7.7</config-property-value>
+      </config-property>
+      <config-property>
+         <description>The Discovery Port</description>
+         <config-property-name>discoveryPort</config-property-name>
+         <config-property-type>java.lang.Integer</config-property-type>
+         <config-property-value>9876</config-property-value>
+      </config-property>
+      <config-property>
+         <description>Do we support HA</description>
+         <config-property-name>hA</config-property-name>
+         <config-property-type>java.lang.Boolean</config-property-type>
+         <config-property-value>true</config-property-value>
+      </config-property>
+      <config-property>
+         <description>reconnect attempts</description>
+         <config-property-name>reconnectAttempts</config-property-name>
+         <config-property-type>java.lang.Integer</config-property-type>
+         <config-property-value>-1</config-property-value>
+      </config-property>
+      
+      <outbound-resourceadapter>
+         <connection-definition>
+            <managedconnectionfactory-class>org.hornetq.ra.HornetQRAManagedConnectionFactory</managedconnectionfactory-class>
+
+            <config-property>
+               <description>The default session type</description>
+               <config-property-name>SessionDefaultType</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+               <config-property-value>javax.jms.Queue</config-property-value>
+            </config-property>
+            <config-property>
+               <description>Try to obtain a lock within specified number of seconds; less than or equal to 0 disable this functionality</description>
+               <config-property-name>UseTryLock</config-property-name>
+               <config-property-type>java.lang.Integer</config-property-type>
+               <config-property-value>0</config-property-value>
+            </config-property>
+
+            <connectionfactory-interface>org.hornetq.ra.HornetQRAConnectionFactory</connectionfactory-interface>
+            <connectionfactory-impl-class>org.hornetq.ra.HornetQRAConnectionFactoryImpl</connectionfactory-impl-class>
+            <connection-interface>javax.jms.Session</connection-interface>
+            <connection-impl-class>org.hornetq.ra.HornetQRASession</connection-impl-class>
+         </connection-definition>
+         <transaction-support>XATransaction</transaction-support>
+         <authentication-mechanism>
+            <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
+            <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
+         </authentication-mechanism>
+         <reauthentication-support>false</reauthentication-support>
+      </outbound-resourceadapter>
+
+      <inbound-resourceadapter>
+         <messageadapter>
+            <messagelistener>
+               <messagelistener-type>javax.jms.MessageListener</messagelistener-type>
+               <activationspec>
+                  <activationspec-class>org.hornetq.ra.inflow.HornetQActivationSpec</activationspec-class>
+                  <required-config-property>
+                      <config-property-name>destination</config-property-name>
+                  </required-config-property>
+               </activationspec>
+            </messagelistener>
+         </messageadapter>
+      </inbound-resourceadapter>
+
+   </resourceadapter>
+</connector>

Added: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/hornetq/javaee/example/MDBRemoteFailoverClientExample.java
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/hornetq/javaee/example/MDBRemoteFailoverClientExample.java	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/hornetq/javaee/example/MDBRemoteFailoverClientExample.java	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ *  Red Hat licenses this file to you under the Apache License, version
+ *  2.0 (the "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ *  implied.  See the License for the specific language governing
+ *  permissions and limitations under the License.
+ */
+
+package org.hornetq.javaee.example;
+
+import javax.jms.*;
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.com">Andy Taylor</a>
+ *         Date: 2/24/11
+ *         Time: 2:44 PM
+ */
+public class MDBRemoteFailoverClientExample
+{
+   public static void main(String[] args) throws Exception
+   {
+      Connection connection = null;
+      InitialContext initialContext = null;
+      try
+      {
+         //Step 1. Create an initial context to perform the JNDI lookup.
+         initialContext = new InitialContext();
+
+         //Step 2. Perfom a lookup on the queue
+         Queue queue = (Queue) initialContext.lookup("/queue/inQueue");
+
+         //Step 3. Perform a lookup on the Connection Factory
+         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
+
+         //Step 4.Create a JMS Connection
+         connection = cf.createConnection();
+
+         //Step 5. Create a JMS Session
+         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         //Step 6. Create a JMS Message Producer
+         MessageProducer producer = session.createProducer(queue);
+
+         //Step 7. Create a Text Message
+         TextMessage message = session.createTextMessage("This is a text message");
+
+         System.out.println("Sent message: " + message.getText());
+
+         //Step 8. Send the Message
+         producer.send(message);
+
+         //Step 15. We lookup the reply queue
+         queue = (Queue) initialContext.lookup("/queue/outQueue");
+
+         //Step 16. We create a JMS message consumer
+         MessageConsumer messageConsumer = session.createConsumer(queue);
+
+         //Step 17. We start the connedction so we can receive messages
+         connection.start();
+
+         //Step 18. We receive the message and print it out
+         message = (TextMessage) messageConsumer.receive(5000);
+
+         System.out.println("message.getText() = " + message.getText());
+
+         System.out.println("Kill Live Server and press enter");
+
+         System.in.read();
+
+         //Step 7. Create a Text Message
+         message = session.createTextMessage("This is another text message");
+
+         System.out.println("Sent message: " + message.getText());
+
+         //Step 8. Send the Message
+         producer.send(message);
+
+         //Step 16. We create a JMS message consumer
+         messageConsumer = session.createConsumer(queue);
+
+         //Step 18. We receive the message and print it out
+         message = (TextMessage) messageConsumer.receive(5000);
+
+         System.out.println("message.getText() = " + message.getText());
+
+      }
+      finally
+      {
+         //Step 19. Be sure to close our JMS resources!
+         if (initialContext != null)
+         {
+            initialContext.close();
+         }
+         if(connection != null)
+         {
+            connection.close();
+         }
+      }
+   }
+}

Added: branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/hornetq/javaee/example/server/MDBRemoteFailoverExample.java
===================================================================
--- branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/hornetq/javaee/example/server/MDBRemoteFailoverExample.java	                        (rev 0)
+++ branches/Branch_2_2_EAP/examples/javaee/mdb-remote-failover/src/org/hornetq/javaee/example/server/MDBRemoteFailoverExample.java	2011-02-25 07:52:02 UTC (rev 10252)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ *  Red Hat licenses this file to you under the Apache License, version
+ *  2.0 (the "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ *  implied.  See the License for the specific language governing
+ *  permissions and limitations under the License.
+ */
+
+package org.hornetq.javaee.example.server;
+
+import org.hornetq.api.jms.HornetQJMSClient;
+import org.jboss.ejb3.annotation.ResourceAdapter;
+
+import javax.annotation.Resource;
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.jms.*;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.com">Andy Taylor</a>
+ *         Date: 2/24/11
+ *         Time: 2:44 PM
+ */
+ at MessageDriven(name = "MDBRemoteFailoverExample",
+               activationConfig =
+                     {
+                        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+                        @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/inQueue")      ,
+                        @ActivationConfigProperty(propertyName = "hA", propertyValue = "true")
+                     })
+ at TransactionManagement(value= TransactionManagementType.CONTAINER)
+ at TransactionAttribute(value= TransactionAttributeType.REQUIRED)
+ at ResourceAdapter("hornetq-ra.rar")
+public class MDBRemoteFailoverExample implements MessageListener
+{
+
+   @Resource(mappedName = "java:RemoteJmsXA")
+   ConnectionFactory connectionFactory;
+   Queue replyQueue;
+
+   public void onMessage(Message message)
+   {
+      Connection conn = null;
+      try
+      {
+         replyQueue = HornetQJMSClient.createQueue("outQueue");
+         //Step 9. We know the client is sending a text message so we cast
+         TextMessage textMessage = (TextMessage)message;
+
+         //Step 10. get the text from the message.
+         String text = textMessage.getText();
+
+         System.out.println("message " + text);
+
+         //Step 11. we create a JMS connection
+         conn = connectionFactory.createConnection();
+
+         //Step 12. We create a JMS session
+         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         //Step 13. we create a producer for the reply queue
+         MessageProducer producer = sess.createProducer(replyQueue);
+
+         //Step 14. we create a message and send it
+         producer.send(sess.createTextMessage("this is a reply"));
+
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+      }
+      finally
+      {
+         if(conn != null)
+         {
+            try
+            {
+               conn.close();
+            }
+            catch (JMSException e)
+            {
+            }
+         }
+      }
+   }
+}



More information about the hornetq-commits mailing list