[overlord-commits] Overlord SVN: r67 - in trunk: samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker and 1 other directories.

overlord-commits at lists.jboss.org overlord-commits at lists.jboss.org
Tue Jun 24 06:30:14 EDT 2008


Author: jeff.yuchang
Date: 2008-06-24 06:30:14 -0400 (Tue, 24 Jun 2008)
New Revision: 67

Added:
   trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/MessageRouterAction.java
Modified:
   trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/BrokerMain.java
   trunk/samples/jbossesb/broker/src/main/resources/META-INF/jboss-esb.xml
Log:
* update the changed codes, as will restructure the folders.


Added: trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/MessageRouterAction.java
===================================================================
--- trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/MessageRouterAction.java	                        (rev 0)
+++ trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/MessageRouterAction.java	2008-06-24 10:30:14 UTC (rev 67)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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) 2008,
+ */
+package org.jboss.soa.overlord.jbossesb.actions;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.overlord.jbossesb.util.MessageUtil;
+
+/**
+ * @author jeffyu
+ *
+ */
+public class MessageRouterAction extends AbstractActionLifecycle {
+	
+	private static Logger logger = Logger.getLogger(MessageRouterAction.class);
+	
+	private ConfigTree config;
+	
+	public MessageRouterAction(ConfigTree config) {
+		this.config = config;
+	}
+
+	public Message process(Message message) throws Exception {
+		ConfigTree[] children = config.getAllChildren();
+		String messageType = MessageUtil.getMessageType(message.getBody().get());
+		logger.debug("The sent message type is [" + messageType + "]");
+		
+		for (ConfigTree ct : children) {
+			ConfigTree[] msgNodes = ct.getChildren("message");
+			String msgType = msgNodes[0].getAttribute("type");
+			if (messageType.equals(msgType)) {
+				String serviceCategory = ct.getAttribute("service-category");
+				String serviceName = ct.getAttribute("service-name");
+				ServiceInvoker invoker = new ServiceInvoker(serviceCategory, serviceName);
+				invoker.deliverAsync(message);
+			}
+		}
+		throw new Exception ("Could not find any services to proceed!");
+	}
+	
+}

Modified: trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/BrokerMain.java
===================================================================
--- trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/BrokerMain.java	2008-06-23 13:03:09 UTC (rev 66)
+++ trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/BrokerMain.java	2008-06-24 10:30:14 UTC (rev 67)
@@ -22,7 +22,9 @@
 import java.util.List;
 
 import org.jboss.soa.overlord.conversation.HibernateObject;
+import org.jboss.soa.overlord.jbossesb.actions.Service;
 
+ at Service(name="{http://www.jboss.org/overlord/loanBroker}Broker", conversationType="Broker", root=true)
 public class BrokerMain implements HibernateObject{
 	
 	private static final long serialVersionUID = 11114L;

Modified: trunk/samples/jbossesb/broker/src/main/resources/META-INF/jboss-esb.xml
===================================================================
--- trunk/samples/jbossesb/broker/src/main/resources/META-INF/jboss-esb.xml	2008-06-23 13:03:09 UTC (rev 66)
+++ trunk/samples/jbossesb/broker/src/main/resources/META-INF/jboss-esb.xml	2008-06-24 10:30:14 UTC (rev 67)
@@ -6,15 +6,56 @@
 		<jms-provider name="JBossMQ" connection-factory="ConnectionFactory" 
 					jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
 					jndi-URL="localhost">
-				<!-- To be done -->
+			<jms-bus busid="BrokerService">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-broker" />
+			</jms-bus>
+			<jms-bus busid="BrokerService1">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-broker1" />
+			</jms-bus>
+			<jms-bus busid="BrokerService2">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-broker2"/>
+			</jms-bus>
+			<jms-bus busid="BrokerService3">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-broker3"/>
+			</jms-bus>
+			<jms-bus busid="BrokerService4">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-broker4"/>
+			</jms-bus>
+			<jms-bus busid="BrokerService5">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-broker5"/>
+			</jms-bus>
+			<jms-bus busid="BrokerService6">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-broker6"/>
+			</jms-bus>
+			<jms-bus busid="BrokerService7">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-broker7"/>
+			</jms-bus>
+			<jms-bus busid="CreditAgencyService">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-creditAgency" />
+			</jms-bus>
+			<jms-bus busid="CreditAgencyService1">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-creditAgency1" />
+			</jms-bus>
+			<jms-bus busid="CreditAgencyService2">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-creditAgency2" />
+			</jms-bus>
+			<jms-bus busid="Supplier">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-supplier" />
+			</jms-bus>
+			<jms-bus busid="Supplier1">
+				<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-supplier1" />
+			</jms-bus>
 		</jms-provider>
 
 	</providers>
+	
 	<services>    
 	
 		<service category="ESBBroker.BrokerParticipant" name="ESBBrokerProcess" description="">
 			<listeners>
-				<!-- To be done -->
+				<jms-listener name="BrokerServiceListener"
+							  busidref="BrokerService"
+							  maxThreads="1"/>	
 			</listeners>
 			<actions mep="OneWay">
 			
@@ -26,7 +67,7 @@
 				not yet exist, and the message being routed will initiate the
 				session - not sure yet if this needs to be flagged specifically. -->
 				
-				<action class="org.jboss.soa.esb.actions.conversation.MessageRouterAction"
+				<action class="org.jboss.soa.overlord.jbossesb.actions.MessageRouterAction"
 							process="process" name="s0-1">
 					<property name="paths">
 						<route service-category="ESBBroker.BrokerParticipant"
@@ -63,8 +104,7 @@
 			<actions mep="OneWay">
 				<action class="org.jboss.soa.esb.actions.conversation.CreateSessionAction"
 							process="process" name="s1-1">
-					<property name="session" value="org.jboss.soa.esb.samples.broker.BrokerMain" />
-					<property name="serviceType" value="{http://www.jboss.org/jbossesb/samples/conversation}BrokerParticipant" />
+					<property name="session" value="org.jboss.soa.overlord.samples.jbossesb.loan.broker.BrokerMain" />
 				</action>
 				<action class="org.jboss.soa.esb.actions.conversation.ReceiveMessageAction"
 							process="process" name="s1-2">




More information about the overlord-commits mailing list