[jboss-svn-commits] JBL Code SVN: r13414 - in labs/jbossesb/trunk/product/samples/quickstarts: dynamic_router and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jul 12 15:04:39 EDT 2007


Author: ldimaggi at redhat.com
Date: 2007-07-12 15:04:39 -0400 (Thu, 12 Jul 2007)
New Revision: 13414

Added:
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/deployment.xml
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jbm-queue-service.xml
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jbmq-queue-service.xml
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jboss-esb.xml
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jbossesb-properties.xml
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jndi.properties
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/juddi.properties
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/lib/
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/log4j.xml
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/readme.txt
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/MyJMSListenerAction.java
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/MyJMSListenerAction2.java
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/QsHashtable.java
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/ReceiveJMSMessage.java
   labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/SendJMSMessage.java
Log:
Initial checkin of dynamic router quickstart




Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/build.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/build.xml	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,48 @@
+<project name="Quickstart_dynamic_router" default="runtest" basedir=".">
+	
+    <description> 
+            ${ant.project.name}
+            ${line.separator}
+    </description>
+
+    <property name="additional.deploys" value="MyESBRules-XPath.drl"/>
+
+    <!-- Import the base Ant build script... -->
+    <import file="../conf/base-build.xml"/>
+
+    <target name="runtest" depends="compile">
+        <echo>Runs JMS Sender - to destination channels</echo>
+        <java fork="yes" classname="quickstart.dynamicRouter.test.SendJMSMessage" failonerror="true">
+            <arg value="ESB dynamic router pattern quickstart - sending message to destination channels"/>
+            <classpath refid="exec-classpath"/>
+        </java>
+    </target>  
+
+    <target name="receive-destination3" depends="compile">
+	        <echo>Runs Test destination message receiver</echo>
+	        <java fork="yes" classname="quickstart.dynamicRouter.test.ReceiveJMSMessage" failonerror="true">
+	            <arg value="queue/qsdynamicrouter_3_Request"/>  
+	            <arg value=":OK"/>
+	            <classpath refid="exec-classpath"/>
+	        </java>
+	    </target>	
+	
+    <target name="receive-destination1" depends="compile">
+	        <echo>Runs Test destination 1 message receiver</echo>
+	        <java fork="yes" classname="quickstart.dynamicRouter.test.ReceiveJMSMessage" failonerror="true">
+	            <arg value="queue/qsdynamicrouter_1_Request"/>  
+	            <arg value=":OK"/>
+	            <classpath refid="exec-classpath"/>
+	        </java>
+	    </target>		
+	
+	   <target name="receive-destination2" depends="compile">
+		        <echo>Runs Test destination 2 message receiver</echo>
+		        <java fork="yes" classname="quickstart.dynamicRouter.test.ReceiveJMSMessage" failonerror="true">
+		            <arg value="queue/qsdynamicrouter_2_Request"/>  
+		            <arg value=":OK"/>
+		            <classpath refid="exec-classpath"/>
+		        </java>
+		    </target>		
+
+</project>

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/deployment.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/deployment.xml	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,4 @@
+<jbossesb-deployment>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=qsdynamicrouter_Input_Request</depends>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=qsdynamicrouter_Control_Request</depends>
+</jbossesb-deployment>

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jbm-queue-service.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jbm-queue-service.xml	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=qsdynamicrouter_Input_Request"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+    <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+  </mbean>
+
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=qsdynamicrouter_Control_Request"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+    <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+  </mbean>
+  
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=qsdynamicrouter_1_Request"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+    <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+  </mbean>
+  
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=qsdynamicrouter_2_Request"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+    <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+  </mbean>
+
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=qsdynamicrouter_3_Request"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+    <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+  </mbean>
+
+</server>

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jbmq-queue-service.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jbmq-queue-service.xml	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=qsdynamicrouter_Control_Request">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
+
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=qsdynamicrouter_3_Request">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
+
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=qsdynamicrouter_1_Request">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
+
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=qsdynamicrouter_2_Request">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
+
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=qsdynamicrouter_Input_Request">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
+
+
+
+</server>

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jboss-esb.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jboss-esb.xml	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,60 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
+
+    <providers>
+        <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
+     
+            <jms-bus busid="dynamicrouterChannel1">
+                <jms-message-filter dest-type="QUEUE" dest-name="queue/B" />
+            </jms-bus>   
+
+            <jms-bus busid="dynamicrouterChannel2">
+                <jms-message-filter dest-type="QUEUE" dest-name="queue/C" />
+            </jms-bus>
+
+            <jms-bus busid="dynamicrouterInputChannel">
+                <jms-message-filter dest-type="QUEUE" dest-name="queue/qsdynamicrouter_Input_Request" />
+            </jms-bus>
+
+            <jms-bus busid="dynamicrouterControlChannel">
+                <jms-message-filter dest-type="QUEUE" dest-name="queue/qsdynamicrouter_Control_Request" />
+            </jms-bus>
+  
+          
+            <!-- Note that only queues that are listened to (input) require jms-provider 
+                 definitions. jms-provider definitions are not required for these queues as 
+                 the quickstart only notifies the queues (output): queue/qsdynamicrouter_3_Request, 
+                 queue/qsdynamicrouter_1_Request, queue/qsdynamicrouter_2_Request -->
+           
+          </jms-provider>
+      </providers>
+      
+      <services>
+     
+      <service category="incomingCategory1" name="incomingService" description="incoming service">
+            <listeners>
+                 <jms-listener name="incoming-Gateway" busidref="dynamicrouterInputChannel" maxThreads="1" is-gateway="true" />
+                 <jms-listener name="native1" busidref="dynamicrouterChannel1" maxThreads="1" /> 
+            </listeners>
+            <actions>             
+                <action name="action1" 
+                class="quickstart.dynamicRouter.MyJMSListenerAction" 
+                process="processMessage"  />      
+            </actions>   
+        </service>
+        
+              <service category="incomingCategory2" name="controlService" description="control service">
+            <listeners>
+                 <jms-listener name="control-Gateway" busidref="dynamicrouterControlChannel" maxThreads="1" is-gateway="true" />
+                 <jms-listener name="native2" busidref="dynamicrouterChannel2" maxThreads="1" /> 
+            </listeners>
+            <actions>             
+                <action name="action2" 
+                class="quickstart.dynamicRouter.MyJMSListenerAction2" 
+                process="processControlMessage"  />      
+            </actions>   
+        </service>
+     
+      </services>     
+     
+</jbossesb>

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jbossesb-properties.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jbossesb-properties.xml	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  JBoss, Home of Professional Open Source
+  Copyright 2006, JBoss Inc., and others contributors as indicated 
+  by the @authors tag. All rights reserved. 
+  See the copyright.txt in the distribution for a
+  full listing of individual contributors. 
+  This copyrighted material is made available to anyone wishing to use,
+  modify, copy, or redistribute it subject to the terms and conditions
+  of the GNU Lesser General Public License, v. 2.1.
+  This program is distributed in the hope that it will be useful, but WITHOUT A 
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+  PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+  You should have received a copy of the GNU Lesser General Public License,
+  v.2.1 along with this distribution; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+  MA  02110-1301, USA.
+  
+  (C) 2005-2006,
+  @author JBoss Inc.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+  These options are described in the JBossESB manual.
+  Defaults are provided here for convenience only.
+ 
+  Please read through this file prior to using the system, and consider
+  updating the specified entries.
+-->
+<esb
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+    <properties name="core">
+		<property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
+		<property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+		<property name="org.jboss.soa.esb.persistence.connection.factory" 	value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+    </properties>
+    <properties name="registry">      
+    	<property name="org.jboss.soa.esb.registry.queryManagerURI"     		
+    		value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>    		
+    	<property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"     		
+    		value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
+    	<property name="org.jboss.soa.esb.registry.implementationClass" 
+    		value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+    	<property name="org.jboss.soa.esb.registry.factoryClass" 
+    		value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+    	<property name="org.jboss.soa.esb.registry.user" 
+    		value="jbossesb"/>
+    	<property name="org.jboss.soa.esb.registry.password" 
+    	  value="password"/>
+    	<!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+    	<property name="org.jboss.soa.esb.scout.proxy.transportClass" 
+    		value="org.apache.ws.scout.transport.RMITransport"/>
+    </properties>
+    <properties name="transports" depends="core">
+    	<property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+    	<property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+    	<property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+    	<property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+    </properties>
+    <properties name="connection">
+    	<property name="min-pool-size" value="5"/>
+    	<property name="max-pool=size" value="10"/>
+    	<property name="blocking-timeout-millis" value="5000"/>
+    	<property name="abandoned-connection-timeout" value="10000"/>
+    	<property name="abandoned-connection-time-interval" value="30000"/>
+    </properties>
+    <properties name="dbstore">
+		<property name="org.jboss.soa.esb.persistence.db.connection.url" 	value="jdbc:hsqldb:hsql://localhost:9001/jbossesb"/>
+		<property name="org.jboss.soa.esb.persistence.db.jdbc.driver" 		value="org.hsqldb.jdbcDriver"/>
+		<property name="org.jboss.soa.esb.persistence.db.user" 			value="sa"/>
+		<property name="org.jboss.soa.esb.persistence.db.pwd" 			value=""/>		
+		<property name="org.jboss.soa.esb.persistence.db.pool.initial.size"	value="2"/>
+		<property name="org.jboss.soa.esb.persistence.db.pool.min.size"	value="2"/>
+		<property name="org.jboss.soa.esb.persistence.db.pool.max.size"	value="5"/>
+		<!--table managed by pool to test for valid connections - created by pool automatically -->
+		<property name="org.jboss.soa.esb.persistence.db.pool.test.table"	value="pooltest"/>
+		<!-- # of milliseconds to timeout waiting for a connection from pool -->
+		<property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis"	value="5000"/> 
+    </properties>
+    <properties name="messagerouting">
+    	<property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+    </properties>
+</esb>

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jndi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jndi.properties	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/jndi.properties	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,5 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+java.naming.factory.url.pkgs=org.jnp.interfaces
+

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/juddi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/juddi.properties	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/juddi.properties	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any 
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct 
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=com.mysql.jdbc.Driver
+juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
+juddi.jdbcUsername=root
+juddi.jdbcPassword=admin
+# jUDDI DataSource to use
+# juddi.dataSource=java:comp/env/jdbc/MySqlDS
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+ 
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+  

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/log4j.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/log4j.xml	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <!-- ============================== -->
+   <!-- Append messages to the console -->
+   <!-- ============================== -->
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <!-- ================================= -->
+   <!-- Preserve messages in a local file -->
+   <!-- ================================= -->
+
+   <!-- A size based file rolling appender -->
+   <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <param name="File" value="./listener.log"/>
+     <param name="Append" value="false"/>
+     <param name="MaxFileSize" value="500KB"/>
+     <param name="MaxBackupIndex" value="1"/>
+
+     <layout class="org.apache.log4j.PatternLayout">
+       <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
+     </layout>	    
+   </appender>
+
+   <!-- ================ -->
+   <!-- Limit categories -->
+   <!-- ================ -->
+
+   <category name="org.jboss">
+      <priority value="WARN"/>
+   </category>
+   <category name="org.jboss.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.jboss.internal.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.apache">
+      <priority value="ERROR"/>
+   </category>
+   <category name="quickstart">
+      <priority value="INFO"/>
+   </category>
+   <!-- ======================= -->
+   <!-- Setup the Root category -->
+   <!-- ======================= -->
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+      <appender-ref ref="FILE"/>
+   </root>
+
+</log4j:configuration>

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/readme.txt	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/readme.txt	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,116 @@
+Overview:
+=========
+        The purpose of the dynamic router list quickstart sample is demonstrate
+        the recipient list EIP pattern (as defined here:
+        http://www.enterpriseintegrationpatterns.com/DynamicRouter.html
+
+Running this quickstart:
+========================
+        Please refer to 'ant help-quickstarts' for prerequisites about the 
+        quickstarts and a more detailed descripton of the different ways to 
+        run the quickstarts.
+
+To Run standalone mode:
+=======================
+    1.  In a command terminal window in the quickstart folder type 'ant deploy-jms-dests'.
+    2.  In a command terminal window in this folder ("Window1"), type 'ant run'.
+    3.  Open another command terminal window in this folder ("Window2"), type ant receive-destination1'
+    4.  Open another command terminal window in this folder ("Window3"), type ant receive-destination2'
+    5.  Open another command terminal window in this folder ("Window4"), type ant receive-destination3'
+    6.  Open another command terminal window in this folder ("Window5"), type 'ant runtest'. 
+        (Note the other ant targets listed below.)
+    7.  Switch back to "Window2", "Window3", "Window4" to see the output from the ESB.
+
+To Run '.esb' archive mode:
+===========================
+    1.  In a command terminal window in this folder ("Window1"), type 'ant undeploy-jms-dests'.
+    2.  In a command terminal window in this folder ("Window1"), type 'ant deploy'.
+    3.  Open another command terminal window in this folder (Window2"), type ant receive-destination1'
+    4.  Open another command terminal window in this folder ("Window3"), type ant receive-destination2'
+    5.  Open another command terminal window in this folder ("Window4"), type ant receive-destination3'
+    6.  Open another command terminal window in this folder ("Window5"), type 'ant runtest'.         
+    7.  Switch back to "Window2", "Window3", "Window4" to see the output from the ESB.
+  
+        You can modify the argument defined in build.xml to control which channels receive the 
+        messages. A value other than ":OK" will result in a destination instance not receiving 
+        messages through the router. Stopping and starting the destination app (for example: 
+        iant receive-destination1) nstance will cause the dynamic router rule base to be updated. 
+        
+        The contents of the Hashtable - this is persisted in a serialized object written to a file 
+        in the server's bin directory - that holds the dynamic router's rule base is displayed on
+        the server's stdout when it is changed. For example:
+        
+        [STDOUT] Writing Hashtable to disk
+        [STDOUT]     Hashtable entry: key = queue/qsdynamicrouter_1_Request, value = OK
+        [STDOUT]     Hashtable entry: key = queue/qsdynamicrouter_2_Request, value = not_OK
+        [STDOUT]     Hashtable entry: key = queue/qsdynamicrouter_3_Request, value = OK        
+
+        The quickstart makes use of the queues illustrated (the queues are shown 
+        in boxes) in the following diagram. You might review the build.xml file to 
+        see how it is setup. More details on the build.xml can be found later in 
+        this document.
+
+      application initiated
+               |
+               |
+               V
+  -------------------------------            --------------------------- 
+  |qsdynamicrouter_Input Request|            |qsdynamicrouter_1_Request| -------> destination1 -> |
+  -------------------------------            ---------------------------                          |
+               |                          /                                                       |
+               |                         |                                                        |
+               |                         |   ---------------------------                          |
+        Message Router  ---------------->|   |qsdynamicrouter_2_Request| ------>  destination2 -> |
+               ^                         |   ---------------------------                          | 
+               |                         |                                                        |
+               |                         \                                                        |
+      Dynamic Rules Base                  \ ---------------------------                           |
+               ^                             |qsdynamicrouter_2_Request| ------>  destination3 -> |
+               |                             ---------------------------                          |
+               |                                                                                  |
+               |                                                                                  |
+               |                             -------------------------------                      |
+               |---------------------------- |dynamicrouter_Control_Request| <--------------------|
+                                             ------------------------------- 
+
+Project File Descriptions
+=========================
+ 
+        * jbossesb.xml - the JMS gateway and ESB configuration file.
+
+        * jbossesb-properties.xml - also needed by jUDDI and needs to
+          be at the head of the classpath.  Both juddi.properties and
+          jbossesb-properties.xml are used when the service first
+          boots up for self-registration based upon the
+          service-category and service-name found in the
+          esb-config.xml file.
+
+        * jndi.properties - needed primarily for
+          quickstart.test.SendJMSMessage that is fired by ant runtest.
+
+        * log4j.xml - needed to configure log4J used by both the
+          quickstart and the ESB itself.  A listener needs a place to
+          log.
+
+        * src\quickstart\staticrouter\test\SendJMSMessage.java -
+          shoots in the string passed in via the command line or in
+          this case the arg attribute in the ant runtest task.
+
+        * src\quickstart\staticrouter\test\ReceiveJMSMessage.java -
+          reads the output queues and displays the messages.
+
+        * build.xml - This quickstart implements the following tasks:
+
+                * runtest - send message thru gateway listener in
+                  MyJMSListener directly to destination queue
+
+                * the echoCP task is useful for making sure what you
+                  think is in your classpath is actually in your
+                  classpath Usage is: ant echoCP > myclasspath.txt
+                  This generates a file called myclasspath.txt which
+                  can be reviewed in a text editor
+ 
+                * the classpath property pulls the
+                  jbossesb-properties.xml file and the
+                  juddi.properties file to the front of the list
+                  
\ No newline at end of file

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/MyJMSListenerAction.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/MyJMSListenerAction.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/MyJMSListenerAction.java	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package quickstart.dynamicRouter;
+
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSession;
+import javax.jms.ObjectMessage;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+import javax.jms.JMSException;
+import javax.jms.TextMessage;
+import javax.jms.QueueSender;
+import javax.naming.NamingException;
+
+import java.util.Enumeration;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.FileOutputStream;
+import java.io.FileInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectInputStream;
+import quickstart.dynamicRouter.test.*;
+import java.util.Hashtable;
+
+public class MyJMSListenerAction extends AbstractActionLifecycle
+{
+    
+  protected ConfigTree	_config;
+  public MyJMSListenerAction(ConfigTree config) { _config = config; } 
+  public Message processMessage(Message message) throws Exception{
+	  
+	  Hashtable theHashtable = QsHashtable.readHash();
+		try {
+			TextMessage tm = null; 
+			
+			for (Enumeration e = theHashtable.keys(); e.hasMoreElements();) {
+				String theKey = (String) e.nextElement();
+				String theValue = (String) theHashtable.get(theKey);
+				
+				// If the queue is "OK" - send the incoming message to that queue 
+				if (theValue.equals("OK")) {
+					
+					// Set up the connection
+					QueueConnection conn1 = null;
+					Queue que;
+					QueueSession session;
+					InitialContext iniCtx = new InitialContext();
+					Object tmp = iniCtx.lookup("ConnectionFactory");
+					QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+					conn1 = qcf.createQueueConnection();
+					que = (Queue) iniCtx.lookup(theKey);
+					session = conn1.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+					conn1.start();
+
+                    // Send the message                						
+					QueueSender send = session.createSender(que);
+					tm = session.createTextMessage(new String(message.getBody().getByteArray()));
+					send.send(tm);
+										
+					// Close the connection
+					send.close();
+					conn1.stop();
+					session.close();
+					conn1.close();
+				}
+			}
+		} 
+		catch (Throwable t) {
+			t.printStackTrace();
+		} /* try and catch */
+
+	  return message; 
+        		
+	} /* method */
+	
+} /* class */
\ No newline at end of file

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/MyJMSListenerAction2.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/MyJMSListenerAction2.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/MyJMSListenerAction2.java	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package quickstart.dynamicRouter;
+
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+import quickstart.dynamicRouter.test.*;
+import java.util.Hashtable;
+
+import java.util.Enumeration;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.FileOutputStream;
+import java.io.FileInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectInputStream;
+
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSession;
+import javax.jms.ObjectMessage;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+import javax.jms.JMSException;
+import javax.jms.TextMessage;
+import javax.jms.QueueSender;
+import javax.naming.NamingException;
+
+public class MyJMSListenerAction2 extends AbstractActionLifecycle {
+	protected ConfigTree _config;
+
+	public MyJMSListenerAction2(ConfigTree config) {
+		_config = config;
+	}
+
+	public Message processControlMessage(Message message) throws Exception {
+
+		Hashtable theHashtable = QsHashtable.readHash();
+		String tm = new String(message.getBody().getByteArray());
+
+		try {
+			// The message contains the queue name and status separated by ":"
+			// for example - queue/queueName:OK - any queue associated with
+			// a value of "OK" is added to the dynamic router data store
+			String[] theStrings = tm.split(":");
+
+			// Make the data store dynamic - to reflect changes in queue status
+			if (theHashtable.containsKey(theStrings[0])) {
+				theHashtable.remove(theStrings[0]);
+			}
+
+			theHashtable.put(theStrings[0], theStrings[1]);
+
+		} catch (Throwable t) {
+			t.printStackTrace();
+		}
+		QsHashtable.writeHash(theHashtable);
+		return message;
+
+	} /* method */
+
+} /* class */

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/QsHashtable.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/QsHashtable.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/QsHashtable.java	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+ 
+ package quickstart.dynamicRouter.test;
+
+import java.util.Hashtable;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.FileOutputStream;
+import java.io.FileInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectInputStream;
+import java.util.Enumeration;
+
+public class QsHashtable {
+
+	public static void writeHash(Hashtable theHashtable) {
+		try {
+			FileOutputStream fileOut = new FileOutputStream("hashtable.ser");
+			ObjectOutputStream out = new ObjectOutputStream(fileOut);
+			out.writeObject(theHashtable);
+			
+			System.out.println("Writing Hashtable to disk");
+			for (Enumeration e = theHashtable.keys(); e.hasMoreElements();) {
+				String theKey = (String) e.nextElement();
+				String theValue = (String) theHashtable.get(theKey);
+				System.out.println("\tHashtable entry: key = " + theKey + ", value = " + theValue);
+            }
+			out.close();
+			fileOut.close();
+		} 
+		catch (FileNotFoundException E) {
+			E.printStackTrace();
+		} 
+		catch (IOException E) {
+			E.printStackTrace();
+		}
+
+	} /* method */
+
+	public static Hashtable readHash() {
+		Hashtable theHashtable = new Hashtable();
+
+		try {
+			FileInputStream fileIn = new FileInputStream("hashtable.ser");
+			ObjectInputStream in = new ObjectInputStream(fileIn);
+			theHashtable = (Hashtable) in.readObject();
+			in.close();
+			fileIn.close();
+		} 
+		catch (ClassNotFoundException E) {
+			E.printStackTrace();
+		} 
+		catch (FileNotFoundException E) {
+			// If the file is not there - it's not a problem as we'll create it
+		} 
+		catch (IOException E) {
+			E.printStackTrace();
+		}
+
+		return theHashtable;
+
+	} /* method */
+
+} /* class */
\ No newline at end of file

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/ReceiveJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/ReceiveJMSMessage.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/ReceiveJMSMessage.java	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package quickstart.dynamicRouter.test;
+
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSession;
+import javax.jms.ObjectMessage;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import javax.jms.MessageListener;
+import javax.jms.Message;
+
+import javax.jms.JMSException;
+import javax.jms.TextMessage;
+import javax.jms.QueueSender;
+import javax.naming.NamingException;
+
+public class ReceiveJMSMessage {
+	QueueConnection conn = null;
+	QueueSession receiverSession = null;
+	Queue receiverQueue = null;
+	QueueReceiver queueReceiver = null;
+	InitialContext iniCtx = null;
+	QueueConnectionFactory qcf = null;
+	String receiveQueueName = "queue/D"; // Default to queue/D
+
+	QueueConnection conn1 = null;
+	Queue que;
+	QueueSession session;
+		
+	// Ref:
+	// http://docs.jboss.org/jbossas/jboss4guide/r5/html/ch6.chapt.html#d0e12917
+	public static class ExListener implements MessageListener {
+		public void onMessage(Message msg) {
+			TextMessage tm = (TextMessage) msg;
+			try {
+				System.out.println("onMessage, control channel recv text=" + tm.getText());
+			} catch (Throwable t) {
+				t.printStackTrace();
+			}
+		} /* method */
+	} /* class */
+
+	public ReceiveJMSMessage() {
+	} /* method */
+
+	public void receiveOne() {
+		try {
+			if (iniCtx == null)
+				iniCtx = new InitialContext();
+			if (qcf == null)
+				qcf = (QueueConnectionFactory) iniCtx
+						.lookup("ConnectionFactory");
+			if (conn == null) {
+				conn = qcf.createQueueConnection();
+				conn.start();
+			}
+
+			receiverQueue = (Queue) iniCtx.lookup(receiveQueueName);
+			receiverSession = conn.createQueueSession(false,
+					QueueSession.AUTO_ACKNOWLEDGE);
+			queueReceiver = receiverSession.createReceiver(receiverQueue);
+			TextMessage msg = (TextMessage) queueReceiver.receive(2000);
+
+			// Ref:
+			// http://docs.jboss.org/jbossas/jboss4guide/r5/html/ch6.chapt.html#d0e12917
+			queueReceiver.setMessageListener(new ExListener());
+
+		} catch (Exception e) {
+			System.out.println(e);
+		}
+	} /* method */
+
+	public void setupConnection() throws JMSException, NamingException {
+		InitialContext iniCtx = new InitialContext();
+		Object tmp = iniCtx.lookup("ConnectionFactory");
+		QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+		conn1 = qcf.createQueueConnection();
+		que = (Queue) iniCtx.lookup("queue/qsdynamicrouter_Control_Request");
+		session = conn1.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+		conn1.start();
+		System.out.println("Connection Started");
+	} /* method */
+
+	public void stop() throws JMSException {
+		conn1.stop();
+		session.close();
+		conn1.close();
+	} /* method */
+
+	public void sendAMessage(String msg) throws JMSException {
+		QueueSender send = session.createSender(que);
+		TextMessage tm = session.createTextMessage(msg);
+		send.send(tm);
+		send.close();
+	} /* method */
+
+	public static void main(String[] args) throws Exception {
+		ReceiveJMSMessage receiver = new ReceiveJMSMessage();
+		
+		// Send the message to the control channel
+		receiver.setupConnection();
+		receiver.sendAMessage(args[0] + args[1]);
+		receiver.stop();
+
+		if (args[0] != null) {
+			receiver.receiveQueueName = args[0];
+			System.out.println("Receiving on: " + receiver.receiveQueueName);
+		}
+		while (true) { // loop until I'm killed
+			receiver.receiveOne();
+		}
+	} /* method */
+
+} /* class */

Added: labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/SendJMSMessage.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/dynamic_router/src/quickstart/dynamicRouter/test/SendJMSMessage.java	2007-07-12 19:04:39 UTC (rev 13414)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package quickstart.dynamicRouter.test;
+
+import javax.jms.JMSException;
+import javax.jms.TextMessage;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+public class SendJMSMessage {
+	QueueConnection conn;
+	QueueSession session;
+	Queue que;
+
+	public void setupConnection() throws JMSException, NamingException {
+		InitialContext iniCtx = new InitialContext();
+		Object tmp = iniCtx.lookup("ConnectionFactory");
+		QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+		conn = qcf.createQueueConnection();
+		que = (Queue) iniCtx.lookup("queue/qsdynamicrouter_Input_Request");
+		session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+		conn.start();
+		System.out.println("Connection Started");
+	} /* method */
+
+	public void stop() throws JMSException {
+		conn.stop();
+		session.close();
+		conn.close();
+	} /* method */
+
+	public void sendAMessage(String msg) throws JMSException {
+		QueueSender send = session.createSender(que);
+		TextMessage tm = session.createTextMessage(msg);
+		send.send(tm);
+		send.close();
+	} /* method */
+
+	public static void main(String args[]) throws Exception {
+		SendJMSMessage sm = new SendJMSMessage();
+		sm.setupConnection();
+		sm.sendAMessage(args[0]);
+		sm.stop();
+	} /* method */
+
+} /* class */




More information about the jboss-svn-commits mailing list