 <p>This is a bug in Spring XD. See <a href="https://jira.spring.io/browse/INT-3908" rel="nofollow">INT-3908</a> for details.</p> <hr> <p>Following the <a href="http://stackoverflow.com/a/34216534/953327">suggestion</a> by Marius, the following is a suitable workaround:</p> <p>Edit <code>$XD_HOME/modules/processor/aggregator/config/aggregator.xml</code> to include:</p> <pre><code>&lt;channel id="aggregatorInput"/&gt; &lt;header-enricher input-channel="input" output-channel="aggregatorInput" default-overwrite="true"&gt; &lt;header name="kafka_messageKey" value="."/&gt; &lt;/header-enricher&gt; &lt;aggregator input-channel="aggregatorInput" output-channel="output" correlation-strategy-expression="${correlation}" release-strategy-expression="${release}" expression="${aggregation}" send-partial-result-on-expiry="true" expire-groups-upon-completion="true" message-store="messageStore"&gt; &lt;/aggregator&gt; </code></pre> <p><strong>Note</strong>: using a <code>header-filter</code> will not work as the mechanism SI uses for <a href="https://github.com/spring-projects/spring-framework/blob/master/spring-messaging/src/main/java/org/springframework/messaging/support/MessageHeaderAccessor.java#L347" rel="nofollow">removing a header</a> will only <a href="https://github.com/spring-projects/spring-framework/blob/master/spring-messaging/src/main/java/org/springframework/messaging/support/MessageHeaderAccessor.java#L309" rel="nofollow">remove the header if it is not already null</a>.</p> <hr> <p>Alternatively, if you don't want to edit the module XML directly, you could use <a href="http://docs.spring.io/spring-xd/docs/current/reference/html/#composing-modules" rel="nofollow">Module Composition</a> to include a Header Enricher before the standard aggregator module.</p> <pre><code>module compose --name kafa-aggregator --definition "header-enricher --headers={\"kafka_messageKey\":\"'.'\"} --overwrite=true | aggregator --count=3 --aggregation=T(org.springframework.util.StringUtils).collectionToDelimitedString(#this.![payload],' ')" stream create --name aggregates --definition "http | kafa-aggregator | log" --deploy </code></pre>