[jboss-svn-commits] JBL Code SVN: r9188 - in labs/jbossesb/trunk/product/core: services/src/org/jboss/soa/esb/services/routing and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jan 31 03:51:42 EST 2007
Author: kurt.stam at jboss.com
Date: 2007-01-31 03:51:42 -0500 (Wed, 31 Jan 2007)
New Revision: 9188
Modified:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedRouter.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/StaticRouter.java
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/routing/MessageRouter.java
Log:
Only tag is process="split" is set in the config. Or else a simple route would overwrite the tagging info.
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedRouter.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedRouter.java 2007-01-31 08:38:10 UTC (rev 9187)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/ContentBasedRouter.java 2007-01-31 08:51:42 UTC (rev 9188)
@@ -78,7 +78,7 @@
}
}
if (outgoingDestinations.size()>0) {
- MessageRouter.deliverMessages(outgoingDestinations, message);
+ MessageRouter.deliverMessages(outgoingDestinations, message, false);
} else if (destinations.size() > 0) {
log.error("The rule destination(s) " + destinations
+ " are not in found in the destination names in the configuration "
@@ -87,7 +87,31 @@
return message;
} // ________________________________
+
+ public Message split(Message message) throws MalformedEPRException, RegistryException, CourierException, MessageRouterException
+ {
+ //Call call = message.getHeader().getCall();
+ //if (null == call || null == call.getMessageID())
+ // throw new IllegalArgumentException("Null message ID");
+ List<String> destinations = _cbr.route(_ruleSet, _ruleLanguage, _ruleReload, message);
+ Collection<String[]> outgoingDestinations = new ArrayList<String[]>();
+ for (String destination : destinations) {
+ if (_destinations.containsKey(destination)) {
+ outgoingDestinations.add(_destinations.get(destination));
+ }
+ }
+ if (outgoingDestinations.size()>0) {
+ MessageRouter.deliverMessages(outgoingDestinations, message, true);
+ } else if (destinations.size() > 0) {
+ log.error("The rule destination(s) " + destinations
+ + " are not in found in the destination names in the configuration "
+ + _destinations.keySet() + ". Please fix your configuration.");
+ }
+
+ return message;
+ } // ________________________________
+
protected void checkMyParms() throws ConfigurationException
{
if (_config.getAttribute(ListenerTagNames.RULE_SET_TAG)==null) {
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/StaticRouter.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/StaticRouter.java 2007-01-31 08:38:10 UTC (rev 9187)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/StaticRouter.java 2007-01-31 08:51:42 UTC (rev 9188)
@@ -63,7 +63,7 @@
// if (null == call || null == call.getMessageID())
// throw new IllegalArgumentException("Null message ID");
- MessageRouter.deliverMessages(_destinations, message);
+ MessageRouter.deliverMessages(_destinations, message, false);
return message;
}
catch (MessageRouterException ex)
@@ -97,6 +97,23 @@
"Problems with destination list", e);
}
} // ________________________________
+
+ public Message split(Message message) throws MalformedEPRException, RegistryException, CourierException
+ {
+ try
+ {
+ // Call call = message.getHeader().getCall();
+ // if (null == call || null == call.getMessageID())
+ // throw new IllegalArgumentException("Null message ID");
+
+ MessageRouter.deliverMessages(_destinations, message, true);
+ return message;
+ }
+ catch (MessageRouterException ex)
+ {
+ throw new MalformedEPRException(ex);
+ }
+ } // ________________________________
protected ConfigTree _config;
Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/routing/MessageRouter.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/routing/MessageRouter.java 2007-01-31 08:38:10 UTC (rev 9187)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/routing/MessageRouter.java 2007-01-31 08:51:42 UTC (rev 9188)
@@ -71,19 +71,23 @@
* Collection with the name of the destination services.
* @param message -
* the message that needs routing and delivery
+ * @param boolean - isSpitter, if true will Tag the messages for
+ * aggregation purposes.
*/
public synchronized static void deliverMessages(
- Collection<String[]> destinations, Message message) throws MessageRouterException
+ Collection<String[]> destinations, Message message, boolean isSplitter) throws MessageRouterException
{
String uuId = UUID.randomUUID().toString();
int counter=0;
for (Iterator<String[]> i = destinations.iterator(); i.hasNext();)
{
- message.getProperties().setProperty(AGGEGRATOR_TAG, uuId + ":" + ++counter + ":" + destinations.size());
- message.getProperties().setProperty(SPLITTER_TIME_STAMP, new java.util.Date().getTime());
- if (logger.isDebugEnabled()) {
- String tag = (String) message.getProperties().getProperty(AGGEGRATOR_TAG);
- logger.debug(AGGEGRATOR_TAG + "=" + tag);
+ if (isSplitter) {
+ message.getProperties().setProperty(AGGEGRATOR_TAG, uuId + ":" + ++counter + ":" + destinations.size());
+ message.getProperties().setProperty(SPLITTER_TIME_STAMP, new java.util.Date().getTime());
+ if (logger.isDebugEnabled()) {
+ String tag = (String) message.getProperties().getProperty(AGGEGRATOR_TAG);
+ logger.debug(AGGEGRATOR_TAG + "=" + tag);
+ }
}
String[] destination = (String[]) i.next();
String category = destination[0];
More information about the jboss-svn-commits
mailing list