[jboss-svn-commits] JBL Code SVN: r12539 - in labs/jbossesb/trunk/product: core/listeners/src/org/jboss/soa/esb/listeners/gateway and 13 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jun 13 08:30:01 EDT 2007
Author: kurt.stam at jboss.com
Date: 2007-06-13 08:30:01 -0400 (Wed, 13 Jun 2007)
New Revision: 12539
Added:
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/FilterRules.drl
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/deployment.xml
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbm-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbmq-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbossesb-properties.xml
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/log4j.xml
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/Order.java
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/test/
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/test/SendEsbMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/test/SendJMSMessage.java
Modified:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/MessageFilter.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContents.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Body.java
labs/jbossesb/trunk/product/samples/quickstarts/messagestore/
labs/jbossesb/trunk/product/samples/quickstarts/messagestore/readme.txt
Log:
JBESB-599 adding messagefilter QuickStart
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/MessageFilter.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/MessageFilter.java 2007-06-13 12:12:35 UTC (rev 12538)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/MessageFilter.java 2007-06-13 12:30:01 UTC (rev 12539)
@@ -70,7 +70,7 @@
}
if (outgoingDestinations.size()>0) {
MessageRouter.deliverMessages(outgoingDestinations, message);
- } else if (destinations.size() > 0) {
+ } else {
log.debug("No destinations where found, the Message is filtered");
}
} catch (MessageRouterException mre) {
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContents.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContents.java 2007-06-13 12:12:35 UTC (rev 12538)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContents.java 2007-06-13 12:30:01 UTC (rev 12539)
@@ -56,6 +56,12 @@
javax.jms.Message jmsMsg = (javax.jms.Message) obj;
Message message = MessageFactory.getInstance().getMessage();
message.getBody().setByteArray(getMessageContent(jmsMsg));
+
+ if (jmsMsg instanceof ObjectMessage) {
+ ObjectMessage msg = (ObjectMessage) jmsMsg;
+ message.getBody().add(msg.getObject());
+ }
+
Enumeration<String> EE = jmsMsg.getPropertyNames();
if (null != EE)
{
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Body.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Body.java 2007-06-13 12:12:35 UTC (rev 12538)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Body.java 2007-06-13 12:30:01 UTC (rev 12539)
@@ -63,7 +63,7 @@
public interface Body
{
- public static final String DEFAULT_LOCATION = "org.jboss.soa.esb.message.defaultEntry";
+ public static final String DEFAULT_LOCATION = "defaultEntry";
/**
* Add the specified Object at the default location within the message. If
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/FilterRules.drl
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/FilterRules.drl (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/FilterRules.drl 2007-06-13 12:30:01 UTC (rev 12539)
@@ -0,0 +1,35 @@
+#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;
+import org.jboss.soa.esb.samples.quickstart.messagefilter.Order;
+
+#declare any global variables here
+global java.util.List destinations;
+
+rule "Pricing Rule - over threshold"
+
+ when
+ m : Message ()
+ order : Order( quantity >= 10)
+ then
+ System.out.println(order.getQuantity() + " Makes the threshold");
+ #we can modify the object
+ order.setDiscount(10);
+ #demonstrate that we can add a new object to the message
+ m.getBody().add("DiscountObject","10%");
+ destinations.add("DemoDestination");
+end
+
+rule "Pricing Rule - under threshold"
+
+ #adding this for debug output, the important part is to *NOT* set a destination
+ when
+ m : Message ()
+ order : Order( quantity < 10)
+ then
+ System.out.println(order.getQuantity() + " Does not make the threshold");
+ order.setDiscount(0);
+end
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/build.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/build.xml 2007-06-13 12:30:01 UTC (rev 12539)
@@ -0,0 +1,33 @@
+<project name="Quickstart_messagefilter" default="run" basedir=".">
+
+ <description>
+ ${ant.project.name}
+ ${line.separator}
+ </description>
+
+ <property name="additional.deploys" value="FilterRules.drl"/>
+
+ <!-- Import the base Ant build script... -->
+ <import file="../conf/base-build.xml"/>
+
+ <target name="runtest" depends="compile"
+ description="sends a JMS message to queue/quickstart_messagefilter_Request_gw">
+ <echo>Runs Test JMS Sender</echo>
+ <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.messagefilter.test.SendJMSMessage" failonerror="true">
+ <arg value="10"/>
+ <classpath refid="exec-classpath"/>
+ </java>
+ </target>
+
+ <target name="sendesb" depends="compile"
+ description="Will send an esb Message">
+ <echo>Runs Test ESB Message Sender</echo>
+ <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.messagefilter.test.SendEsbMessage" failonerror="true">
+ <arg value="FirstServiceESB"/> <!-- service category -->
+ <arg value="MessageFilterListener"/> <!-- service name -->
+ <arg value="9"/> <!-- quantity -->
+ <classpath refid="exec-classpath"/>
+ </java>
+ </target>
+
+</project>
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/build.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/deployment.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/deployment.xml 2007-06-13 12:30:01 UTC (rev 12539)
@@ -0,0 +1,6 @@
+<jbossesb-deployment>
+ <depends>jboss.esb:deployment=jbrules.esb</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagefilter_Request_esb</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagefilter_Request_gw</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagefilter_next_Request_esb</depends>
+</jbossesb-deployment>
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/deployment.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbm-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbm-queue-service.xml 2007-06-13 12:30:01 UTC (rev 12539)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagefilter_Request_esb"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagefilter_Request_gw"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagefilter_next_Request_esb"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbm-queue-service.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbmq-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbmq-queue-service.xml 2007-06-13 12:30:01 UTC (rev 12539)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagefilter_Request_esb">
+ <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=quickstart_messagefilter_Request_gw">
+ <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=quickstart_messagefilter_next_Request_esb">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+</server>
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbmq-queue-service.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jboss-esb.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jboss-esb.xml 2007-06-13 12:30:01 UTC (rev 12539)
@@ -0,0 +1,82 @@
+<?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="JBossMessaging" connection-factory="ConnectionFactory">
+
+ <jms-bus busid="quickstartGwChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_messagefilter_Request_gw"
+ />
+ </jms-bus>
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_messagefilter_Request_esb"
+ />
+ </jms-bus>
+ <jms-bus busid="quickstartNextEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_messagefilter_next_Request_esb"
+ />
+ </jms-bus>
+
+ </jms-provider>
+ </providers>
+
+ <services>
+ <service
+ category="FirstServiceESB"
+ name="MessageFilterListener"
+ description="Filter a Message Based on Content">
+ <listeners>
+ <jms-listener name="gw-channel"
+ busidref="quickstartGwChannel"
+ maxThreads="1"
+ is-gateway="true"
+ />
+ <jms-listener name="esb-channel"
+ busidref="quickstartEsbChannel"
+ maxThreads="1"
+ />
+ </listeners>
+ <actions>
+ <action class="org.jboss.soa.esb.actions.MessageFilter" name="MessageFilter">
+ <property name="ruleSet" value="FilterRules.drl"/>
+ <property name="ruleReload" value="true"/>
+ <property name="destinations">
+ <route-to destination-name="DemoDestination" service-category="Test" service-name="NextService"/>
+ </property>
+ <property name="object-paths">
+ <object-path path="body.defaultEntry" />
+ </property>
+ </action>
+ </actions>
+ </service>
+ <service
+ category="Test"
+ name="NextService"
+ description="Demo Destination">
+ <listeners>
+ <jms-listener name="esb-channel"
+ busidref="quickstartNextEsbChannel"
+ maxThreads="1"
+ />
+ </listeners>
+ <actions>
+ <!-- Print the message to the console -->
+ <action name="notificationAction" class="org.jboss.soa.esb.actions.Notifier">
+ <property name="okMethod" value="notifyOK" />
+ <property name="notification-details">
+ <NotificationList>
+ <target class="NotifyConsole" />
+ </NotificationList>
+ </property>
+ </action>
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jboss-esb.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbossesb-properties.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbossesb-properties.xml 2007-06-13 12:30:01 UTC (rev 12539)
@@ -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>
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jbossesb-properties.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jndi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jndi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jndi.properties 2007-06-13 12:30:01 UTC (rev 12539)
@@ -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
+
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/jndi.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/log4j.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/log4j.xml 2007-06-13 12:30:01 UTC (rev 12539)
@@ -0,0 +1,79 @@
+<?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"/>
+ <param name="Threshold" value="INFO"/>
+
+ <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="DEBUG"/>
+ </category>
+ <category name="org.jboss.internal.soa.esb">
+ <priority value="DEBUG"/>
+ </category>
+ <category name="org.apache">
+ <priority value="ERROR"/>
+ </category>
+ <category name="quickstart">
+ <priority value="DEBUG"/>
+ </category>
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/log4j.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/readme.txt (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/readme.txt 2007-06-13 12:30:01 UTC (rev 12539)
@@ -0,0 +1,88 @@
+Overview:
+=========
+ The purpose of the messagefilter quickstart sample is to show how to filter
+ a messag based on content. Here we pass in an Order object and the FilterRules
+ parse this object to looks for the quantity. If the quantity does not meet
+ the threshold of 10, then the message is filter out. On the console you should see:
+
+ [STDOUT] 9 Does not make the threshold
+
+ In the build.xml you can change the default argument from '9' to '10' to see
+
+ [STDOUT] 10 Makes the threshold
+
+ In this case the message will get forwarded to the DemoService (service-category="Test" service-name="NextService")
+ which prints out the message to the console.
+
+
+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 runtest'.
+ 4. Switch back to "Window1" 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 runtest'.
+ 4. Switch back to Application Server console to see the output from the ESB
+
+ 'run' target description:
+ In a command prompt window, start the listeners by simply running "ant"
+ in this directory. 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. Shutdown
+ the listener by simply using Ctrl-C in that window.
+
+ 'runtest' target description:
+ In a separate command prompt window, run "ant runtest" to shoot a JMS message
+ into the listener which will then invoke the MyJMSListenerAction and display
+ it to the console. You can modify the build.xml to change the phrase
+ "Hello World" to something else and re-run "ant runtest".
+
+Project file descriptions:
+==========================
+
+ jbossesb.xml:
+ The JMS gateway and ESB configuration file. It is listening for JMS ObjectMessages or TextMessages
+ at "queue/quickstart_messagestore_Request". Messages received at "quickstart_messagestore_Request" are
+ converted jbossesb-properties.xml. Also needed by jUDDI and needs to be at the head of the classpath.
+ The jbossesb-properties.xml is 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 org.jboss.soa.esb.samples.quickstart.messagestore.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\CheckMessageStoreAction.java:
+ The action class that is identified in the esb-config.xml file and is called whenever a message is received.
+
+ src\quickstart\helloworld\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\helloworld\test\SendEsbMessage.java:
+ Shoots in the string passed in via the command line or in this case the arg atribute in the ant sendesb task.
+ This demonstrates how to build an "ESB aware" client that can invoke an ESB service.
+
+ build.xml:
+ Targets and structure description:
+ * the classpath property pulls the jbossesb-properties.xml file to the
+ front of the list
+ * 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 run task calls the Launcher passing in 3 arguments the most important are the esb-config.xml and
+ esb-config-gateway.xml files
+ * the runtest task calls the org.jboss.soa.esb.samples.quickstart.helloworld.test.SendJMSMessage class and passes in an argument representing
+ the string-based message to be pused into the queue the gateway is listening on. Note: SendJMSMessage
+ contains a hard-coded queue name.
+
+
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/Order.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/Order.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/Order.java 2007-06-13 12:30:01 UTC (rev 12539)
@@ -0,0 +1,61 @@
+/*
+ * 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-2007
+ */
+package org.jboss.soa.esb.samples.quickstart.messagefilter;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @author kstam
+ *
+ */
+public class Order implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ private int quantity;
+ private BigDecimal unitPrice;
+ private double discount;
+ private BigDecimal totalPrice;
+
+ public double getDiscount() {
+ return discount;
+ }
+ public void setDiscount(double discount) {
+ this.discount = discount;
+ }
+ public int getQuantity() {
+ return quantity;
+ }
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+ public BigDecimal getTotalPrice() {
+ return totalPrice;
+ }
+ public void setTotalPrice(BigDecimal totalPrice) {
+ this.totalPrice = totalPrice;
+ }
+ public BigDecimal getUnitPrice() {
+ return unitPrice;
+ }
+ public void setUnitPrice(BigDecimal unitPrice) {
+ this.unitPrice = unitPrice;
+ }
+}
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/Order.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/test/SendEsbMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/test/SendEsbMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/test/SendEsbMessage.java 2007-06-13 12:30:01 UTC (rev 12539)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.samples.quickstart.messagefilter.test;
+
+import java.net.URI;
+import java.util.UUID;
+
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.listeners.ListenerUtil;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.samples.quickstart.messagefilter.Order;
+
+/**
+ * Standalone class with to send ESB messages to a 'known' [category,name].
+ * <p/> arg0 - service category
+ * <br/>arg1 - service name
+ * <br/>arg2 - Text of message to send
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ * @since Version 4.0
+ *
+ */
+public class SendEsbMessage
+{
+ public static void main(String args[]) throws Exception
+ {
+ if (args.length < 3)
+ {
+ System.out.println("Usage SendEsbMessage <category> <name> <text to send>");
+ }
+ //Setting the ConnectionFactory such that it will use scout
+ System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
+ // Create a message, assign it a UID, and fill in call information
+ Message esbMessage = MessageFactory.getInstance().getMessage();
+ Call call = new Call();
+ call.setMessageID(new URI(UUID.randomUUID().toString()));
+ esbMessage.getHeader().setCall(call);
+
+ // set body contents with args[2], and send
+ esbMessage.getBody().setByteArray(args[2].getBytes());
+ Order order = new Order();
+ order.setQuantity(Integer.valueOf(args[2]));
+ esbMessage.getBody().add(order);
+
+ ListenerUtil.tryToDeliver(esbMessage, args[0], args[1]);
+
+ }
+
+}
\ No newline at end of file
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/test/SendEsbMessage.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/test/SendJMSMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/test/SendJMSMessage.java 2007-06-13 12:30:01 UTC (rev 12539)
@@ -0,0 +1,82 @@
+/*
+ * 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 org.jboss.soa.esb.samples.quickstart.messagefilter.test;
+
+import java.io.Serializable;
+
+import javax.jms.JMSException;
+import javax.jms.ObjectMessage;
+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;
+
+import org.jboss.soa.esb.samples.quickstart.messagefilter.Order;
+
+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_messagefilter_Request_gw");
+ 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(Serializable msg) throws JMSException {
+
+ QueueSender send = session.createSender(que);
+ ObjectMessage tm = session.createObjectMessage(msg);
+ send.send(tm);
+ send.close();
+ }
+
+
+ public static void main(String args[]) throws Exception
+ {
+ Order order = new Order();
+ order.setQuantity(Integer.valueOf(args[0]));
+ SendJMSMessage sm = new SendJMSMessage();
+ sm.setupConnection();
+ sm.sendAMessage(order);
+ sm.stop();
+
+ }
+
+}
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/messagefilter/src/org/jboss/soa/esb/samples/quickstart/messagefilter/test/SendJMSMessage.java
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/messagestore
___________________________________________________________________
Name: svn:ignore
+ build
lib
Modified: labs/jbossesb/trunk/product/samples/quickstarts/messagestore/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagestore/readme.txt 2007-06-13 12:12:35 UTC (rev 12538)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagestore/readme.txt 2007-06-13 12:30:01 UTC (rev 12539)
@@ -1,6 +1,6 @@
Overview:
=========
- The purpose of the helloworld quickstart sample is to show how to store
+ The purpose of the messagestore quickstart sample is to show how to store
a message in the MessageStore. The only interesting piece of configuration
is:
More information about the jboss-svn-commits
mailing list