[jboss-svn-commits] JBL Code SVN: r7952 - in labs/jbossesb/trunk/product/samples/quickstarts: . simple_cbr simple_cbr/lib simple_cbr/src simple_cbr/src/quickstart simple_cbr/src/quickstart/test simple_cbr/src/services simple_cbr/src/services/rules
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Nov 29 16:47:38 EST 2006
Author: burrsutter
Date: 2006-11-29 16:47:18 -0500 (Wed, 29 Nov 2006)
New Revision: 7952
Added:
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/SampleOrder.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/esb-config-gateway.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/esb-config.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/jbossesb-properties.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/juddi.properties
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/lib/
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/lib/mysql-connector-java-3.1.12-bin.jar
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/log4j.xml
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/Launcher.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/MyJMSListenerAction.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/ReturnJMSMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/RouteExpressShipping.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/RouteNormalShipping.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/test/
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/test/ReceiveJMSMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/test/SendJMSMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/services/
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/services/rules/
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/services/rules/MyESBRules-XPath.drl
labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/services/rules/MyESBRules.drl
Log:
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/SampleOrder.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/SampleOrder.xml 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/SampleOrder.xml 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,12 @@
+<Order orderId="1" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="0"
+netAmount="59.97" totalAmount="64.92" tax="4.95">
+ <Customer userName="user1" firstName="Harry" lastName="Fletcher" state="SD"/>
+ <OrderLines>
+ <OrderLine position="1" quantity="1">
+ <Product productId="364" title="The 40-Year-Old Virgin " price="29.98"/>
+ </OrderLine>
+ <OrderLine position="2" quantity="1">
+ <Product productId="299" title="Pulp Fiction" price="29.99"/>
+ </OrderLine>
+ </OrderLines>
+</Order>
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/build.xml 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/build.xml 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,102 @@
+<project name="Quickstart_simple_cbr" default="run" basedir=".">
+ <property name="jbossesbhome.dir"
+ value="/labs/ESBWorkspace/ESBTrunk/product" />
+ <property name="jbosshome.dir"
+ value="/jBoss/jboss-4.0.4.GA_EJB3a"/>
+ <property name="jbossesbdist.dir" value="${jbossesbhome.dir}/build/dist/lib"/>
+ <property name="build.dir"
+ value="${basedir}/build"/>
+ <property name="src.dir"
+ value="${basedir}/src"/>
+
+ <property name="quickstart.dir" value="${jbossesbhome.dir}/samples/quickstarts"/>
+ <property name="esb-config"
+ value="${quickstart.dir}/simple_cbr/esb-config.xml"/>
+ <property name="esb-config-gateway"
+ value="${quickstart.dir}/simple_cbr/esb-config-gateway.xml"/>
+
+ <path id="classpath">
+ <fileset dir="${basedir}" includes="jbossesb-properties.xml"/>
+ <fileset dir="${basedir}" includes="juddi.properties"/>
+ <fileset dir="${basedir}" includes="smooks-cdr.lst"/>
+ <fileset dir="${basedir}" includes="smooks-res.xml"/>
+ <fileset dir="${basedir}/src" includes="*st"/>
+ <fileset dir="${basedir}/lib" includes="*jar"/>
+ <fileset dir="${jbossesbdist.dir}" includes="*jar"/>
+ <fileset dir="${jbossesbdist.dir}" includes="*xml"/>
+ <fileset dir="${jbossesbhome.dir}/lib/ext" includes="*jar"/>
+ <fileset dir="${jbosshome.dir}/client" includes="*jar"/>
+ <fileset dir="${jbosshome.dir}/server/default/lib">
+ <include name="jboss-j2ee.jar"/> <!-- added this for the JMS client -->
+ </fileset>
+
+ <fileset dir="${basedir}" includes="build/**/*.jar"/>
+ <fileset dir="${basedir}" includes="build/**/*.xml"/>
+ <pathelement location="." />
+ </path>
+
+ <property name="cp" refid="classpath"/>
+
+ <target name="echoCP">
+ <echo message="Classpath is ${cp}"/>
+ </target>
+
+ <target name="prepare">
+ <mkdir dir="${build.dir}" />
+ </target>
+
+ <target name="clean">
+ <delete dir="${build.dir}" />
+ </target>
+
+ <target name="compile" depends="prepare">
+ <javac srcdir="${src.dir}"
+ destdir="${build.dir}">
+ <classpath refid="classpath"/>
+ </javac>
+ </target>
+
+ <target name="jars" depends="compile">
+ <delete file="${build.dir}/${ant.project.name}.jar"/>
+ <jar destfile="${build.dir}/${ant.project.name}.jar"
+ basedir="${build.dir}"
+ includes="**/*.class"/>
+ <!-- Rules files must be jarred and on the classpath -->
+ <jar destfile="${build.dir}/${ant.project.name}_Rules.jar"
+ basedir="${basedir}/src/services/rules" includes="*.*"/>
+ </target>
+
+ <target name="run" depends="jars">
+ <echo>Basic JMS Gateway and Listener</echo>
+ <java fork="yes" classname="quickstart.Launcher" failonerror="true">
+ <arg value="0"/>
+ <arg value="${esb-config}"/>
+ <arg value="${esb-config-gateway}"/>
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+
+ <target name="runtest">
+ <echo>Runs Test JMS Sender</echo>
+ <java fork="yes" classname="quickstart.test.SendJMSMessage" failonerror="true">
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+
+ <target name="receiveExpress">
+ <echo>Runs Test JMS Receiver</echo>
+ <java fork="yes" classname="quickstart.test.ReceiveJMSMessage" failonerror="true">
+ <arg value="queue/CBRExpressFreeShippingAlert"/>
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+
+ <target name="receiveNormal">
+ <echo>Runs Test JMS Receiver</echo>
+ <java fork="yes" classname="quickstart.test.ReceiveJMSMessage" failonerror="true">
+ <arg value="queue/CBRNormalShippingAlert"/>
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+
+</project>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/esb-config-gateway.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/esb-config-gateway.xml 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/esb-config-gateway.xml 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,15 @@
+<esb-config-gateway parameterReloadSecs="180">
+ <esb-jms-gateway
+ target-service-category="MyFirstCBRServices"
+ target-service-name="FirstCBRService"
+ gatewayClass="org.jboss.soa.esb.listeners.gateway.JmsGatewayListener"
+ connection-factory="ConnectionFactory"
+ destination-type="queue"
+ destination-name="queue/quickstart_simple_cbr_Request"
+ jndi-type="jboss"
+ jndi-URL="localhost"
+ >
+ <!-- no action needed as the inbound message is automatically converted
+ and sent to the queue for the target service -->
+ </esb-jms-gateway>
+</esb-config-gateway>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/esb-config.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/esb-config.xml 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/esb-config.xml 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,42 @@
+<esb-config parameterReloadSecs="180">
+ <XPathContentBasedRouter
+ service-category="MyFirstCBRServices"
+ service-name="FirstCBRService"
+ service-description="This CBR routes messages to different service destinations based Order totalAmount"
+ listenerClass="org.jboss.soa.esb.listeners.message.CbrJmsQueueListener"
+ connection-factory="ConnectionFactory"
+ destination-type="queue"
+ destination-name="queue/B"
+ jndi-type="jboss"
+ jndi-URL="localhost">
+ <cbr ruleSet="MyESBRules-XPath.drl" ruleLanguage="XPathLanguage.dsl" />
+ <!-- XPathLanguage.dsl lives in core\services\rules\XPathLanguage.dsl jbossesb-rules.jar -->
+ </XPathContentBasedRouter>
+
+ <ExpressShippingService
+ service-category="ExpressShipping"
+ service-name="ExpressShippingService"
+ listenerClass="org.jboss.soa.esb.listeners.message.JmsQueueListener"
+ connection-factory="ConnectionFactory"
+ destination-type="queue"
+ destination-name="queue/CBRExpressFreeShipping"
+ jndi-type="jboss"
+ jndi-URL="localhost">
+ <action class="quickstart.MyJMSListenerAction" process="displayMessage" exceptionMethod="exceptionHandler" />
+ <action class="quickstart.RouteExpressShipping" process="noOperation" okMethod="sendResponse"/>
+ </ExpressShippingService>
+
+ <NormalShippingService
+ service-category="NormalShipping"
+ service-name="NormalShippingService"
+ listenerClass="org.jboss.soa.esb.listeners.message.JmsQueueListener"
+ connection-factory="ConnectionFactory"
+ destination-type="queue"
+ destination-name="queue/CBRNormalShipping"
+ jndi-type="jboss"
+ jndi-URL="localhost">
+ <action class="quickstart.MyJMSListenerAction" process="displayMessage" exceptionMethod="exceptionHandler" />
+ <action class="quickstart.RouteNormalShipping" process="noOperation" okMethod="sendResponse"/>
+ </NormalShippingService>
+
+</esb-config>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/jbossesb-properties.xml 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/jbossesb-properties.xml 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,77 @@
+<?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="org.apache.juddi.registry.local.InquiryService#inquire"/>
+ <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI" value="org.apache.juddi.registry.local.PublishService#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.LocalTransport"/>
+ </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/simple_cbr/jndi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/jndi.properties 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/jndi.properties 2006-11-29 21:47:18 UTC (rev 7952)
@@ -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/simple_cbr/juddi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/juddi.properties 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/juddi.properties 2006-11-29 21:47:18 UTC (rev 7952)
@@ -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/simple_cbr/lib/mysql-connector-java-3.1.12-bin.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/lib/mysql-connector-java-3.1.12-bin.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/log4j.xml 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/log4j.xml 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,84 @@
+<?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="org.milyn">
+ <priority value="ERROR"/>
+ </category>
+
+ <category name="quickstarts">
+ <priority value="ERROR"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/readme.txt 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/readme.txt 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,46 @@
+The purpose of the simple_cbr quickstart is to demonstrate the Content Based Router in JBoss ESB.
+
+To self-demonstrate the example, open 4 command windows and insure that Ant and Java are in the PATH,
+then execute the following commands, in order, one per command window:
+ant
+ant receiveExpress
+ant receiveNormal
+ant runtest
+
+"ant" - starts the listeners
+"ant receiveExpress" - in another command window, this process will wait for messages to hit the
+queue/CBRExpressFreeShippingAlert queue
+"ant receiveNormal" - in another command window, this process will wait for messages to hit the
+queue/CBRNormalShippingAlert queue
+"ant runtest" - in another command window, this process will pick up the SampleOrder.xml and shot it into
+the queue/quickstart_simple_cbr_Request queue which is identified in the esb-config-gateway.xml
+
+Use a text editor to change the "totalAmount" in the order above/below $50 and re-execute ant runtest to
+see the order flash up in the different receivers.
+<Order orderId="1" orderDate="Wed Nov 15 13:45:28 EST 2006" statusCode="0"
+ netAmount="59.97" totalAmount="64.92" tax="4.95">
+
+What follows are the highlights that uncover some of the magic associated with CBR:
+* src\services\rules\MyESBRules-XPath.drl is a JBoss Rules ruleset that has simple logic that evaluates
+the totalAmount attribute of the SampleOrder.xml. Over $50 means Free Express shipping, Under $50 means
+Normal shipping.
+* src\services\rules\MyESBRules.drl can be used for selecting a path based upon a piece of meta-data
+as opposed to the message content. It is not used in the example but provided anyway.
+* src\quickstart\test\ReceiveJMSMessage.java has been modified to accept the queue to listen to from
+the command line (from build.xml)
+* RouteExpressShipping.java - simply pushes the message to the CBRExpressFreeShippingAlert queue
+* RouteNormalShipping.java - simply pushes the message to the CBRNormalShippingAlert queue
+* build.xml creates an additional jar file for the rules files. This jar file is also loaded into the
+classpath.
+ <jar destfile="${build.dir}/${ant.project.name}_Rules.jar"
+ basedir="${basedir}/src/services/rules" includes="*.*"/>
+
+* esb-config.xml establishes 3 services. The first is the perform the CBR evaluation and has this
+action:
+ <cbr ruleSet="MyESBRules-XPath.drl" ruleLanguage="XPathLanguage.dsl" />
+ XPathLanguage.dsl lives in core\services\rules\XPathLanguage.dsl and ships as jbossesb-rules.jar
+
+ * MyESBRules-XPath.drl routes to the appropriate destination service via this command
+ Destination : "ExpressShipping:ExpressShippingService";
+ "ExpressShipping" is the service-category (found in esb-config.xml)
+ "ExpressShippingService" is the service-name (also found in the esb-config.xml)
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/Launcher.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/Launcher.java 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/Launcher.java 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,84 @@
+package quickstart;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.listeners.gateway.GatewayListenerController;
+import org.jboss.soa.esb.listeners.message.EsbListenerController;
+
+
+public class Launcher {
+ private static Log log = LogFactory.getLog(Launcher.class);
+
+ private EsbListenerController _esbListController;
+ private GatewayListenerController _gatewayController;
+
+
+
+ private Logger _logger = Logger.getLogger(Launcher.class);
+
+ public static void main (String args[]) throws Exception {
+
+ log.info("args passed into Launcher: " + args.length);
+ for (int x=0; x<args.length; x++)
+ log.info("arg[" + x + "]=" + args[x]);
+
+
+ Launcher launcher = new Launcher();
+
+ launcher.triggerListener(Long.valueOf(args[0]).longValue(), args[1], args[2]);
+
+ }
+
+ private void triggerListener(long runTime, String messageAwareConfigFile,
+ String gatewayConfigFile) throws Exception{
+ try
+ {
+
+ if (null != messageAwareConfigFile) {
+ _logger.info("starting message aware listener with config file - " +
+ messageAwareConfigFile);
+ _esbListController = new EsbListenerController(messageAwareConfigFile);
+
+ new Thread(_esbListController).start();
+ Thread.sleep(2000);
+
+ }
+ if (null != gatewayConfigFile) {
+ _logger.info("starting gateway listener with config file - " +
+ gatewayConfigFile);
+ _gatewayController = new GatewayListenerController(gatewayConfigFile);
+ new Thread(_gatewayController).start();
+
+ Thread.sleep(2000);
+ }
+
+ System.out.println("**Listener Ready**");
+
+// This code is used to automatically shutdown the listeners which
+// might be useful for automated testing purposes. It is not needed
+// in the quickstart samples.
+// _logger.info("going to sleep now for " + runTime + " milliseconds...");
+// Thread.sleep(runTime);
+// if (null != messageAwareConfigFile) {
+// _logger.info("shutting down message aware listener...");
+// _esbListController.requestEnd();
+// }
+//
+// if (null != gatewayConfigFile) {
+// _logger.info("shutting down gateway listener...");
+// _gatewayController.requestEnd();
+// }
+
+
+ }
+ catch (Exception e) {
+ _logger.error(e);
+ throw(e);
+ }
+
+
+ }
+
+
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/MyJMSListenerAction.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/MyJMSListenerAction.java 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/MyJMSListenerAction.java 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,47 @@
+package quickstart;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.Header;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.EPR;
+import org.apache.log4j.Logger;
+
+public class MyJMSListenerAction
+{
+
+ protected ConfigTree _config;
+
+ public MyJMSListenerAction(ConfigTree config) { _config = config; }
+
+ public Message noOperation(Message message) { return message; }
+
+ public Message displayMessage(Message message) throws Exception{
+ logHeader();
+ System.out.println("Body: " + new String(message.getBody().getContents()));
+ logFooter();
+ return message;
+ }
+
+ public void exceptionHandler(Message message, Throwable exception) {
+ logHeader();
+ System.out.println("!ERROR!");
+ System.out.println(exception.getMessage());
+ System.out.println("For Message: ");
+ System.out.println(message.getBody().getContents());
+ logFooter();
+ }
+
+
+ // This makes it easier to read on the console
+ private void logHeader() {
+ System.out.println("\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+ }
+ private void logFooter() {
+ System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n");
+ }
+
+
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/ReturnJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/ReturnJMSMessage.java 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/ReturnJMSMessage.java 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,49 @@
+package quickstart;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.jms.JMSException;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.QueueSender;
+import javax.jms.ObjectMessage;
+import javax.jms.TextMessage;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import org.jboss.soa.esb.message.Message;
+
+public class ReturnJMSMessage {
+
+ public static void sendMessage(Message esbMessage,String newDestination) throws JMSException, NamingException, Exception {
+ if (esbMessage == null || newDestination == null)
+ throw new Exception("Message and JMS Destination are required");
+
+ QueueConnection conn;
+ QueueSession session;
+ Queue que;
+
+ InitialContext iniCtx = new InitialContext();
+ Object tmp = iniCtx.lookup("ConnectionFactory");
+ QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+ conn = qcf.createQueueConnection();
+ que = (Queue) iniCtx.lookup("queue/" + newDestination);
+ session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ conn.start();
+
+
+ String newMsg = new String(esbMessage.getBody().getContents());
+
+
+ QueueSender send = session.createSender(que);
+ TextMessage tm = session.createTextMessage(newMsg);
+ send.send(tm);
+
+
+ conn.stop();
+ }
+
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/RouteExpressShipping.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/RouteExpressShipping.java 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/RouteExpressShipping.java 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,37 @@
+package quickstart;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+public class RouteExpressShipping {
+
+ protected Message _message;
+ protected ConfigTree _config;
+
+ public RouteExpressShipping(ConfigTree config) { _config = config; }
+
+ // used to send response
+ public Message noOperation(Message message) { return message; }
+
+ public void sendResponse(Message message) {
+ try {
+ logHeader();
+ System.out.println(new String(message.getBody().getContents()));
+ System.out.println("EXPRESS EXPRESS EXPRESS");
+ logFooter();
+ ReturnJMSMessage.sendMessage(message,"CBRExpressFreeShippingAlert");
+ } catch (Exception e) {
+ logHeader();
+ System.out.println(e.getMessage());
+ logFooter();
+ }
+ }
+ private void logHeader() {
+ System.out.println("\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+ }
+ private void logFooter() {
+ System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n");
+ }
+
+
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/RouteNormalShipping.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/RouteNormalShipping.java 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/RouteNormalShipping.java 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,37 @@
+package quickstart;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+public class RouteNormalShipping {
+
+ protected Message _message;
+ protected ConfigTree _config;
+
+ public RouteNormalShipping(ConfigTree config) { _config = config; }
+
+ // used to send response
+ public Message noOperation(Message message) { return message; }
+
+ public void sendResponse(Message message) {
+ try {
+ logHeader();
+ System.out.println(new String(message.getBody().getContents()));
+ System.out.println("NORMAL SHIPPING");
+ logFooter();
+ ReturnJMSMessage.sendMessage(message,"CBRNormalShippingAlert");
+ } catch (Exception e) {
+ logHeader();
+ System.out.println(e.getMessage());
+ logFooter();
+ }
+ }
+ private void logHeader() {
+ System.out.println("\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+ }
+ private void logFooter() {
+ System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n");
+ }
+
+
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/test/ReceiveJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/test/ReceiveJMSMessage.java 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/test/ReceiveJMSMessage.java 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,55 @@
+package quickstart.test;
+
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSession;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+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
+
+ public ReceiveJMSMessage() {
+
+ }
+ 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);
+ if (msg != null) {
+ System.out.println("*********************************************************");
+ System.out.println(msg);
+ System.out.println("*********************************************************");
+ }
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+ public static void main(String[] args) {
+ ReceiveJMSMessage receiver = new ReceiveJMSMessage();
+
+ if(args[0] != null) {
+ receiver.receiveQueueName = args[0];
+ System.out.println("Receiving on: " + receiver.receiveQueueName );
+ }
+ while (true) { // loop until I'm killed
+ receiver.receiveOne();
+ }
+ }
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/test/SendJMSMessage.java 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/quickstart/test/SendJMSMessage.java 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,90 @@
+package quickstart.test;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.jms.JMSException;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.QueueSender;
+import javax.jms.ObjectMessage;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+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/quickstart_simple_cbr_Request");
+ session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ conn.start();
+ System.out.println("Connection Started");
+ }
+
+ public void stop() throws JMSException
+ {
+ conn.stop();
+ session.close();
+ conn.close();
+ }
+
+ public void sendAMessage(String msg) throws JMSException {
+
+ QueueSender send = session.createSender(que);
+ ObjectMessage tm = session.createObjectMessage(msg);
+ send.send(tm);
+ send.close();
+ }
+ public String readAsciiFile(String fileName) throws IOException {
+ FileReader fr = null;
+ char[] thechars = null;
+
+ try {
+ File thefile = new File( fileName );
+ fr = new FileReader( thefile );
+ int size = (int) thefile.length();
+ thechars = new char[size];
+
+ int count, index = 0;
+
+ // read in the bytes from the input stream
+ while( ( count = fr.read( thechars, index, size ) ) > 0 ) {
+ size -= count;
+ index += count;
+ }
+ } catch(Exception e) {
+ System.out.println(e);
+ }
+ finally {
+ if( fr != null )
+ fr.close();
+ }
+ return new String(thechars);
+
+ } // readAsciiFile
+
+ public static void main(String args[]) throws Exception
+ {
+ SendJMSMessage sm = new SendJMSMessage();
+ sm.setupConnection();
+ String fileContent = sm.readAsciiFile("SampleOrder.xml");
+ System.out.println("---------------------------------------------");
+ System.out.println(fileContent);
+ System.out.println("---------------------------------------------");
+ sm.sendAMessage(fileContent);
+ sm.stop();
+
+ }
+
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/services/rules/MyESBRules-XPath.drl
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/services/rules/MyESBRules-XPath.drl 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/services/rules/MyESBRules-XPath.drl 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,35 @@
+#created on: Nov 8, 2006
+package com.jboss.soa.esb.routing.cbr
+
+#list any import classes here.
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageType;
+
+expander MyXPathLanguage.dsl
+
+#declare any global variables here
+global java.util.List destinationServices;
+
+
+
+rule "Routing Rule using XPATH"
+
+ when
+ xpathGreaterThan "/Order/@totalAmount", "50.0"
+ then
+ Log : "EXPRESS";
+ Log : "EXPRESS";
+ Log : "Really It's EXPRESS Shipping";
+ Destination : "ExpressShipping:ExpressShippingService";
+
+end
+
+rule "Routing Rule using XPATH less"
+ when
+ xpathLessThan "/Order/@totalAmount", "50.0"
+ then
+ Log : "NORMAL";
+ Log : "NORMAL";
+ Log : "Really It's NORMAL Shipping";
+ Destination : "NormalShipping:NormalShippingService";
+end
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/services/rules/MyESBRules.drl
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/services/rules/MyESBRules.drl 2006-11-29 21:46:08 UTC (rev 7951)
+++ labs/jbossesb/trunk/product/samples/quickstarts/simple_cbr/src/services/rules/MyESBRules.drl 2006-11-29 21:47:18 UTC (rev 7952)
@@ -0,0 +1,29 @@
+#created on: Oct 30, 2006
+package com.jboss.soa.esb.routing.cbr
+
+#list any import classes here.
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageType;
+
+#declare any global variables here
+global java.util.List destinationServices;
+
+
+rule "Routing Rule - Serialized based message"
+
+ when
+ Message( type == MessageType.JAVA_SERIALIZED)
+ then
+ System.out.println("Serialized");
+ destinationServices.add("Serialized_ServiceDestinationCat:Serialized_ServiceDestination");
+
+end
+
+rule "Routing Rule - XML based message"
+
+ when
+ Message( type == MessageType.JBOSS_XML)
+ then
+ System.out.println("JBoss_XML");
+ destinationServices.add("CBRContent:ContentBasedRoutingService");
+end
\ No newline at end of file
More information about the jboss-svn-commits
mailing list