servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r410794 - in /incubator/servicemix/trunk/servicemix-eip/src: main/java/org/apache/servicemix/eip/patterns/ main/java/org/apache/servicemix/eip/support/ test/java/org/apache/servicemix/eip/
Date Thu, 01 Jun 2006 08:45:38 GMT
Author: gnodet
Date: Thu Jun  1 01:45:37 2006
New Revision: 410794

URL: http://svn.apache.org/viewvc?rev=410794&view=rev
Log:
Fix problems with non re-readable sources (stream sources)

Modified:
    incubator/servicemix/trunk/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/ContentBasedRouter.java
    incubator/servicemix/trunk/servicemix-eip/src/main/java/org/apache/servicemix/eip/support/AbstractAggregator.java
    incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/AbstractEIPTest.java

Modified: incubator/servicemix/trunk/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/ContentBasedRouter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/ContentBasedRouter.java?rev=410794&r1=410793&r2=410794&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/ContentBasedRouter.java
(original)
+++ incubator/servicemix/trunk/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/ContentBasedRouter.java
Thu Jun  1 01:45:37 2006
@@ -19,6 +19,7 @@
 import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -88,22 +89,26 @@
         try {
             if (exchange.getRole() == MessageExchange.Role.PROVIDER &&
                 exchange.getProperty(correlation) == null) {
-                // Retrieve target
-                ExchangeTarget target = getDestination(exchange);
                 // Create exchange for target
                 MessageExchange tme = exchangeFactory.createExchange(exchange.getPattern());
                 if (store.hasFeature(Store.CLUSTERED)) {
                     exchange.setProperty(JbiConstants.STATELESS_PROVIDER, Boolean.TRUE);
                     tme.setProperty(JbiConstants.STATELESS_CONSUMER, Boolean.TRUE);
                 }
-                target.configureTarget(tme, getContext());
                 // Set correlations
-                exchange.setProperty(correlation, tme.getExchangeId());
                 tme.setProperty(correlation, exchange.getExchangeId());
+                exchange.setProperty(correlation, tme.getExchangeId());
                 // Put exchange to store
                 store.store(exchange.getExchangeId(), exchange);
-                // Send in to listener and target
-                MessageUtil.transferTo(exchange, tme, "in"); 
+                // Now copy input to new exchange
+                // We need to read the message once for finding routing target
+                // so ensure we have a re-readable source
+                NormalizedMessage in = MessageUtil.copyIn(exchange);
+                MessageUtil.transferToIn(in, tme); 
+                // Retrieve target
+                ExchangeTarget target = getDestination(tme);
+                target.configureTarget(tme, getContext());
+                // Send in to target
                 send(tme);
             // Mimic the exchange on the other side and send to needed listener
             } else {

Modified: incubator/servicemix/trunk/servicemix-eip/src/main/java/org/apache/servicemix/eip/support/AbstractAggregator.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-eip/src/main/java/org/apache/servicemix/eip/support/AbstractAggregator.java?rev=410794&r1=410793&r2=410794&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/main/java/org/apache/servicemix/eip/support/AbstractAggregator.java
(original)
+++ incubator/servicemix/trunk/servicemix-eip/src/main/java/org/apache/servicemix/eip/support/AbstractAggregator.java
Thu Jun  1 01:45:37 2006
@@ -126,7 +126,7 @@
                         }
                         // If the aggregation is not closed
                         if (aggregation != null) {
-                            if (addMessage(aggregation, MessageUtil.copyIn(exchange), exchange))
{
+                            if (addMessage(aggregation, in, exchange)) {
                                 sendAggregate(correlationId, aggregation, false);
                             } else {
                                 store.store(correlationId, aggregation);

Modified: incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/AbstractEIPTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/AbstractEIPTest.java?rev=410794&r1=410793&r2=410794&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/AbstractEIPTest.java
(original)
+++ incubator/servicemix/trunk/servicemix-eip/src/test/java/org/apache/servicemix/eip/AbstractEIPTest.java
Thu Jun  1 01:45:37 2006
@@ -51,6 +51,7 @@
         jbi = new JBIContainer();
         jbi.setEmbedded(true);
         jbi.setUseMBeanServer(false);
+        jbi.setCreateMBeanServer(false);
         configureContainer();
         listener = new ExchangeCompletedListener();
         jbi.addListener(listener);



Mime
View raw message