Announcement Announcement Module
Collapse
No announcement yet.
Override the springintegration_sequenceSize & springintegration_sequenceNumber Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Override the springintegration_sequenceSize & springintegration_sequenceNumber

    I have a implementation which is something as shown below.
    Code:
                                          inputChannel
                                                    |
                                                Filter 
                                                    |
                                              Splitter(1)
                                                 |||||
                                              Router                                              
                                                / \  
                                               /   \
                                              /     \
                                          (SA)      Splitter (2)
                                          /               \\     
                       OutputChannel(Queue)      ||    
                                 |                        /|\    
                                 |                       / | \
                                 |                      /  |  \
                                 |                     /   |   \
                                 |                 (SA) (SA) (SA)
                                 |                   /     |     \           
                                 |             OutputChannel(Queue)       
                                 |                  |          
                            Aggregator (which will aggregate the message based on the correlation key)

    If you check the above implementation I have used 2 splitter.
    one at the top & another at the branch of Router. Now when I aggregate the message (which takes a path of 2 splitter) I want to make sure that the messages which are processed by SA (which is splitted by second splitter) to be aggregate with the ones of the parent splitter,

    Say for Example Splitter (1) generates 3 message which goes to router & then to second splitter(2) which internally creates 2 more message (i.e 3x2 =6) for each message received. SA will get 6 messages which will be processed & passed to aggregator. Now I want to make sure that I get all 6 messages grouped together. As of now I am getting only 3 messages since

    springintegration_sequenceSize =3 in header.

    can we override the springintegration_sequenceSize & springintegration_sequenceNumber in the second splitter.

  • #2
    In complex aggregation scenarios I recommend to correlate and release on business keys instead of using the default sequence headers. It's usually possible to keep using those headers with some hacking, but it is a recipe for unreadable code.

    Comment


    • #3
      Originally posted by iwein View Post
      In complex aggregation scenarios I recommend to correlate and release on business keys instead of using the default sequence headers. It's usually possible to keep using those headers with some hacking, but it is a recipe for unreadable code.
      I have used custom correlation-strategy as that of Cafe example, but it is still showing me only 3 messages.
      Note I am using message builder & copy the header of the main message in the splitted Message.

      Comment


      • #4
        With the flow drawn above (nice artwork) I actually don't see how could you modify the standard headers anyway and make the aggregation at the end in one step. Some messages go down the left branch, and they will always have the original sequence and correlation details. Even if everything goes down the right side the second splitter has no way to know the correct sequence size because the answer depends on the content of other messages.

        You end up needing a stateful splitter that can't release any messages until it has the whole sequence, which amounts to a second aggregator. So maybe the best way to deal with it is to use a second aggregator somewhere, so that the nesting of the sequences is rolled back up hierarchically?

        Alternatively the framework could do some of that work for you, and the aggregator could be informed that it needs to search up the stack of sequence information, e.g. depending on the presence of a special header (which the messages down the right side would have). If the aggregator combines the first and second sequences in the stack for right-hand messages then I think it will have all the information it needs.

        There is a similarity with https://jira.springsource.org/browse/INT-1500 (from a similar forum post). But it's definitely a new feature (and perilously close to 2.0), and there should be a workaround involving a second aggregator (plus splitter and some header manipulation) upstream of the main one.

        Comment


        • #5
          I don't think this has the highest priority for 2.0.0, but if you create a testcase you might get lucky this weekend. I'm just saying....

          Comment

          Working...
          X