[jboss-svn-commits] JBL Code SVN: r8581 - in labs/jbossesb/trunk/product/samples/quickstarts/helloworld: . src/quickstart/helloworld/test
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Dec 22 20:33:31 EST 2006
Author: estebanschifman
Date: 2006-12-22 20:33:27 -0500 (Fri, 22 Dec 2006)
New Revision: 8581
Added:
labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/quickstart/helloworld/test/SendEsbMessage.java
Modified:
labs/jbossesb/trunk/product/samples/quickstarts/helloworld/build.xml
Log:
Modified: labs/jbossesb/trunk/product/samples/quickstarts/helloworld/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld/build.xml 2006-12-23 00:33:16 UTC (rev 8580)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld/build.xml 2006-12-23 01:33:27 UTC (rev 8581)
@@ -80,4 +80,15 @@
<classpath refid="classpath"/>
</java>
</target>
+
+ <target name="sendEsb">
+ <echo>Runs Test JMS Sender</echo>
+ <java fork="yes" classname="quickstart.helloworld.test.SendJMSMessage" failonerror="true">
+ <arg value="FirstServiceESB"/> <!-- service category -->
+ <arg value="SimpleListener"/> <!-- service name -->
+ <arg value="Hello World - Straight to listener - no Gateway"/> <!-- Message text -->
+ <classpath refid="classpath"/>
+ </java>
+ </target>
+
</project>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/quickstart/helloworld/test/SendEsbMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/quickstart/helloworld/test/SendEsbMessage.java 2006-12-23 00:33:16 UTC (rev 8580)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/quickstart/helloworld/test/SendEsbMessage.java 2006-12-23 01:33:27 UTC (rev 8581)
@@ -0,0 +1,64 @@
+/*
+ * 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 quickstart.helloworld.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;
+
+/**
+ * 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>");
+ }
+ // 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().setContents(args[2].getBytes());
+
+ ListenerUtil.tryToDeliver(esbMessage, args[0], args[1]);
+
+ }
+
+}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list