camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1360530 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/test/java/org/apache/camel/processor/aggregator/
Date Thu, 12 Jul 2012 05:25:58 GMT
Author: davsclaus
Date: Thu Jul 12 05:25:58 2012
New Revision: 1360530

URL: http://svn.apache.org/viewvc?rev=1360530&view=rev
Log:
CAMEL-5437: Fixed using sendEmptyMessageWhenIdle=true on a batch consumer such as File now
working with Aggregate EIP when using completionFromBatchConsumer

Added:
    camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateCompletedByBatchConsumerSendEmptyMessageWhenIdleTest.java
      - copied unchanged from r1360527, camel/trunk/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateCompletedByBatchConsumerSendEmptyMessageWhenIdleTest.java
Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/ScheduledBatchPollingConsumer.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1360527

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jul 12 05:25:58 2012
@@ -1 +1 @@
-/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360526
+/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527

Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/ScheduledBatchPollingConsumer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/ScheduledBatchPollingConsumer.java?rev=1360530&r1=1360529&r2=1360530&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/ScheduledBatchPollingConsumer.java
(original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/ScheduledBatchPollingConsumer.java
Thu Jul 12 05:25:58 2012
@@ -20,6 +20,7 @@ import java.util.concurrent.ScheduledExe
 
 import org.apache.camel.BatchConsumer;
 import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.ShutdownRunningTask;
 import org.apache.camel.spi.ShutdownAware;
@@ -112,4 +113,15 @@ public abstract class ScheduledBatchPoll
         // we are shutting down so only continue if we are configured to complete all tasks
         return ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask;
     }
+
+    @Override
+    protected void processEmptyMessage() throws Exception {
+        Exchange exchange = getEndpoint().createExchange();
+        // enrich exchange, so we send an empty message with the batch details
+        exchange.setProperty(Exchange.BATCH_INDEX, 0);
+        exchange.setProperty(Exchange.BATCH_SIZE, 1);
+        exchange.setProperty(Exchange.BATCH_COMPLETE, true);
+        log.debug("Sending empty message as there were no messages from polling: {}", this.getEndpoint());
+        getProcessor().process(exchange);
+    }
 }



Mime
View raw message