You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2012/07/12 08:59:15 UTC
svn commit: r1360550 - in /camel/branches/camel-2.9.x: ./
camel-core/src/main/java/org/apache/camel/impl/
camel-core/src/test/java/org/apache/camel/processor/aggregator/
Author: davsclaus
Date: Thu Jul 12 06:59:14 2012
New Revision: 1360550
URL: http://svn.apache.org/viewvc?rev=1360550&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.9.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateCompletedByBatchConsumerSendEmptyMessageWhenIdleTest.java
- copied unchanged from r1360530, camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateCompletedByBatchConsumerSendEmptyMessageWhenIdleTest.java
Modified:
camel/branches/camel-2.9.x/ (props changed)
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1360527
Merged /camel/branches/camel-2.10.x:r1360530
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java?rev=1360550&r1=1360549&r2=1360550&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java (original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java Thu Jul 12 06:59:14 2012
@@ -21,6 +21,7 @@ import java.util.concurrent.ScheduledExe
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
+import org.apache.camel.BatchConsumer;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.LoggingLevel;
@@ -185,6 +186,14 @@ public abstract class ScheduledPollConsu
*/
protected void processEmptyMessage() throws Exception {
Exchange exchange = getEndpoint().createExchange();
+
+ if (this instanceof BatchConsumer) {
+ // 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);
}