Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring Integration @Splitter, what is happening to the header values I have modified?
    text
    copied!<p>I have a spring integration splitter with the following method signature:</p> <pre><code>@Splitter public List&lt;Message&lt;String[]&gt;&gt; splitCsvIntoSeperateMessages(Message&lt;List&lt;String[]&gt;&gt; message) </code></pre> <p>The message payload is an ArrayList of String[]. The splitter reads each row in the List, Creates a new Message setting the payload to the data item in the List, adds a CorrelationId, SequenceNumber and SequenceSize to the header and finally returns an ArrayList of Messages.</p> <p>The problem is that when each individual message is sent to the next channel, the CorrelationId, SequenceNumber and SequenceSize are all overwritten with new values. Is that expected behavior or am I missing something?</p> <p>Code Snippet Below:</p> <hr> <pre><code>@Splitter public List&lt;Message&lt;String[]&gt;&gt; splitCsvIntoSeperateMessages(Message&lt;List&lt;String[]&gt;&gt; message) { List&lt;Message&lt;String[]&gt;&gt; returnVal = new ArrayList&lt;Message&lt;String[]&gt;&gt;(); String headerId = null; int sequenceSize = 0; int sequenceNumber = 0; for(String[] payload : message.getPayload()){ if(payload[0].equals("HEAD")){ headerId = UUID.randomUUID().toString(); sequenceSize = Integer.parseInt(payload[payload.length-1]); sequenceNumber=0; } sequenceNumber++; Message&lt;String[]&gt; msg = MessageBuilder .withPayload(payload) .setCorrelationId(headerId) .setSequenceSize(sequenceSize) .setSequenceNumber(sequenceNumber) .build(); returnVal.add(msg); } return returnVal; } </code></pre> <hr> <p>Using Spring Integration 2.0 M6</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload