[jboss-svn-commits] JBL Code SVN: r24211 - in labs/jbossesb/workspace/skeagh: examples/jms-bus and 9 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Dec 2 10:30:42 EST 2008


Author: tfennelly
Date: 2008-12-02 10:30:42 -0500 (Tue, 02 Dec 2008)
New Revision: 24211

Added:
   labs/jbossesb/workspace/skeagh/examples/jms-bus/README.html
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/infile.txt
   labs/jbossesb/workspace/skeagh/examples/jms-bus/images/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/images/message-flow.png
Removed:
   labs/jbossesb/workspace/skeagh/examples/jms-bus/README.TXT
Modified:
   labs/jbossesb/workspace/skeagh/examples/file-routing/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/
   labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/jboss-esb.xml
   labs/jbossesb/workspace/skeagh/examples/jms-routing/
   labs/jbossesb/workspace/skeagh/examples/jms-routing/esb/
   labs/jbossesb/workspace/skeagh/examples/jms-routing/jms-consumer/
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/PrintlnService.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2182


Property changes on: labs/jbossesb/workspace/skeagh/examples/file-routing
___________________________________________________________________
Name: svn:ignore
   - jbossesb-examples-file-router.iml

   + jbossesb-examples-file-router.iml
*.iml



Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus
___________________________________________________________________
Name: svn:ignore
   + *.iml


Deleted: labs/jbossesb/workspace/skeagh/examples/jms-bus/README.TXT
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/README.TXT	2008-12-02 14:42:29 UTC (rev 24210)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/README.TXT	2008-12-02 15:30:42 UTC (rev 24211)
@@ -1,79 +0,0 @@
-About This Example:
-===================
-     This example illustrates simple JMS Inbound and Outbound Routing.
-
-     The example is composed of a number of parts:
-        *  A JMS Client.  This send a JMS message (captured from stdin) to a JMS Queue that is being
-           listened to by a JmsInboundRouter configured on the ESB.  Execute in step #7 below.
-        *  An ESB Server instance deployed in an Apache Felix OSGi container.  This contains the ESB
-           components, as well as an ESB deployment instance (see src/main/resources/jboss-esb.xml).
-           This part of the example is in the "esb" folder and started in step #6 below.
-        *  A JMS message "consumer" application which is routed to by the ESB through a
-           JmsOutboundRouter.  This is started in step #3 below.
-
-     So the flow of the message is:
-                                           _________
-                                          |         |
-            JMS Client --> JMS Queue <--  |   ESB   |  --> JMS Queue <-- JMS Consumer App
-                                          |_________|
-
-How to Run?
-===========
-     Requirements:
-        1.  JDK 1.5
-        2.  Maven 2.x (http://maven.apache.org/download.html)
-
-     Building:
-            Just type "mvn clean install" inside this folder.
-
-     Running:
-        1.  From the "examples/util/jms-provider" directory run:
-			"mvn activemq:run"
-			This starts the JMS Provider.
-        2.  Open a new console window ("Window 2")
-        3.  From the "jms-consumer" directory run:
-			"mvn exec:java"
-			This starts a JMS Consumer that listens to the outbound routers queue. 
-        4.  Open a new console window ("Window 3")
-        5.  From the "esb" directory run:
-			"mvn pax:provision"
-			This will start JBossESB in OSGi container Felix.
-        6.  Open a new console window ("Window 4")
-        7.  From the "esb" directory run:
-			"mvn exec:java"
-			Type something at the command line and hit return. The text typed will become the message payload. 
-			This will post a JMS Message to the inbound routers queue. 
-			To exit the client type CTRL-C.
-
-		We recommend that you setup the windows so they all can be seen at the same time. The jms-provider
-		window does not need to be visible as no output is expected to it.
-
-Expected output
-===============
-		"Window 4" (JMS Client):
-		> Specify message payload test >some text
-		Sent message [ID:danbev-laptop-41003-1227008237853-1:0:1:1:1] to [jbossesb.TestQueue]
-
-		"Window 3" (esb service deployment):
-		---------------------------------------------------------------------->
-		Message payload 'some text'
-		<----------------------------------------------------------------------
-
-		"Window 2" (jms-consumer):
-		[ Received Message[1]
-		[JMSMessageID : ID:danbev-laptop-54663-1227008186571-1:0:1:1:1]
-		[JMSCorrelelationID : ID:danbev-laptop-41003-1227008237853-1:0:1:1:1]
-		[MessageType : TextMessage]
-		[Text : 
-			some text]
-		]
-
-Things to try
-=============
-	At the felix commmand prompt ("Window 2"):
-	>ps 		// will list all bundles
-	>stop <id>	// use the id of the JBoss ESB - JMS Router Example (5.0.0.SNAPSHOT)
-	>start <id> // use the id of the JBoss ESB - JMS Router Example (5.0.0.SNAPSHOT)
-
-	Notice how the esb undeploy and deploys the bundle.
-

Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/README.html
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/README.html	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/README.html	2008-12-02 15:30:42 UTC (rev 24211)
@@ -0,0 +1,52 @@
+<html>
+<head>
+    <title>JMS Bus Example</title>
+</head>
+<body>
+
+<h2>Overview</h2>
+This example illustrates how a JMS Bus can be used to exchange messages
+between multiple ESB deployments.
+
+The message flow is as follows:
+<img src="images/message-flow.png" />
+
+<p/>
+As you can see, there are 3 Services spread across 2 ESB deployments, each deployed
+on 2 separate OSGi containers. A message to pulled from an inbound file queue (via
+a FileInboundRouter), routed through ESB1:Service1 to ESB2:Service via the JMS Bus,
+then back to ESB1:Service2 via the Bus (again) and then out to the File out folder
+(via a FileOutboundRouter).
+
+<h2>Running</h2>
+
+<b>Requirements:</b>
+<ol>
+    <li>JDK 1.5</li>
+    <li>Maven 2.x (http://maven.apache.org/download.html)</li>
+</ol>
+
+<b>Building:</b><br/>
+<ol>
+    <li>Just type "mvn clean install" inside this folder.</li>
+</ol>
+<p/>
+
+<b>Running:</b>
+<ol>
+    <li>From the "examples/util/jms-provider" directory run "mvn activemq:run".
+        This starts the JMS Provider.</li>
+    <li>Open a new console window ("Window 2").</li>
+    <li>From the "esb1" directory run "mvn pax:provision". This starts the OSGi
+        container instance container "esb1".</li>
+    <li>From the "esb2" directory run "mvn pax:provision". This starts the OSGi
+        container instance container "esb2".</li>
+    <li>Copy the "infile.txt" file from the "esb1" folder into the "esb1/target." </li>
+</ol>
+
+Check the OSGi container consoles.  You should see the message details printed on
+the console.  Also, a message should have been dumped in the out folder in
+"esb1/target/service2-received".
+
+</body>
+</html>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1
___________________________________________________________________
Name: svn:ignore
   + *.iml


Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/infile.txt
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/infile.txt	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/infile.txt	2008-12-02 15:30:42 UTC (rev 24211)
@@ -0,0 +1 @@
+Hi there... JBoss ESB 5.0!!!
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml	2008-12-02 14:42:29 UTC (rev 24210)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb1/src/main/resources/jboss-esb.xml	2008-12-02 15:30:42 UTC (rev 24211)
@@ -7,16 +7,24 @@
     </resources>
 
     <services>
-        <service serviceCategory="ESB1" serviceName="Service" serviceDescription="ESB1 Service" class="org.jboss.esb.test.PrintlnService">
+        <service serviceCategory="ESB1" serviceName="Service1" serviceDescription="ESB1 Service1" class="org.jboss.esb.test.PrintlnService">
             <inRouter name="fileRouter" class="org.jboss.esb.file.FileInboundRouter">
                 <property name="scheduleResourceId">schedule1</property>
-                <property name="fileSelectorPattern">target/*.txt</property>
+                <property name="fileSelectorPattern">../target/*.txt</property>
             </inRouter>
             <outRouter name="route-to-ESB2-Service" class="org.jboss.esb.invoke.ServiceRouter">
                 <property name="toCategory">ESB2</property>
                 <property name="toService">Service</property>
+                <property name="replyToCategory">ESB1</property>
+                <property name="replyToService">Service2</property>
             </outRouter>
         </service>
+
+        <service serviceCategory="ESB1" serviceName="Service2" serviceDescription="ESB1 Service2" class="org.jboss.esb.test.PrintlnService">
+            <outRouter name="fileOutboundRouter" class="org.jboss.esb.file.FileOutboundRouter">
+                <property name="fileNamePattern">../target/service2-received/${name}.out</property>
+            </outRouter>
+        </service>
     </services>
 
 </jbossesb>


Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2
___________________________________________________________________
Name: svn:ignore
   + *.iml


Modified: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/jboss-esb.xml	2008-12-02 14:42:29 UTC (rev 24210)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/src/main/resources/jboss-esb.xml	2008-12-02 15:30:42 UTC (rev 24211)
@@ -1,7 +1,8 @@
 <jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
 
     <services>
-        <service serviceCategory="ESB2" serviceName="Service" serviceDescription="ESB1 Service" class="org.jboss.esb.test.PrintlnService" />
+        <service serviceCategory="ESB2" serviceName="Service" serviceDescription="ESB1 Service"
+                 class="org.jboss.esb.test.PrintlnService" mep="In-Out" />
     </services>
 
 </jbossesb>

Added: labs/jbossesb/workspace/skeagh/examples/jms-bus/images/message-flow.png
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-bus/images/message-flow.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream


Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-routing
___________________________________________________________________
Name: svn:ignore
   - jbossesb-examples-jms-router.iml

   + jbossesb-examples-jms-router.iml
*.iml



Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-routing/esb
___________________________________________________________________
Name: svn:ignore
   - jbossesb-examples-jms-router-esb-jms-router.iml
runner

   + jbossesb-examples-jms-router-esb-jms-router.iml
runner
*.iml



Property changes on: labs/jbossesb/workspace/skeagh/examples/jms-routing/jms-consumer
___________________________________________________________________
Name: svn:ignore
   - jbossesb-examples-jms-router-consumer.iml

   + jbossesb-examples-jms-router-consumer.iml
*.iml


Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/PrintlnService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/PrintlnService.java	2008-12-02 14:42:29 UTC (rev 24210)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/test/PrintlnService.java	2008-12-02 15:30:42 UTC (rev 24211)
@@ -56,7 +56,7 @@
         System.out.println();
         System.out.println("Invocation Params: " + invocationContext.getInvocationParameters());
         System.out.println();
-        System.out.println("Message Payload: " + message.getPayload());
+        System.out.println("Message Payload: " + payloadToString(message.getPayload()));
         System.out.println();
         System.out.println("Message Attachments: " + message.getAttachments());
         System.out.println();
@@ -64,4 +64,19 @@
 
         return message;
     }
+
+    /**
+     * Convert the payload object to a string.
+     * @param payload The payload object.
+     * @return The payload as a String.
+     */
+    private String payloadToString(final Object payload)
+    {
+        if(payload instanceof byte[])
+        {
+            return new String((byte[]) payload);
+        }
+
+        return payload.toString();
+    }
 }




More information about the jboss-svn-commits mailing list