Results 1 to 7 of 7

Thread: aggregator w/ correlation-strategy-expression only working once

  1. #1
    Join Date
    Mar 2012
    Posts
    9

    Default aggregator w/ correlation-strategy-expression only working once

    My use case is that I would like to aggregate a batch of messages w/ no correlation strategy before sending it to another channel. Unfortunately, a correlation strategy is required, so I tried the following workaround but it only works for the first batch:

    <int:aggregator id = "myAggregator"
    input-channel = "inputChannel"
    output-channel = "outputChannel"
    send-partial-result-on-expiry = "true"
    send-timeout = "1000"
    correlation-strategy-expression = "1"
    release-strategy-expression = "size() gt 20"
    />

    Any idea why this only works once?

    Thanks in advance,

    Steve

  2. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Look at this sample: https://github.com/olegz/s12gx.2011/...ion/aggregator
    It talks about exactly the same issue. You can also see the youtube version which touches in this and other use cases http://www.youtube.com/watch?v=RY6dN...5&feature=plcp
    Basically you need to set "expire-groups-upon-completion" attribute to false
    Code:
    expire-groups-upon-completion="false"

  3. #3
    Join Date
    Mar 2012
    Posts
    9

    Default

    Oleg,

    Thanks for the quick reply.

    I didn't see that attribute in the reference manual; however, it looks like it's false by default. I tried setting it explicitly to false but I still have the same problem.

    I failed to mention it, but I'm using spring-integration-2.2.0.M2.

    Steve

  4. #4
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    If you go through that demo you'll see that you ned to set it to true. Just go through the read me and/or the screencast

  5. #5
    Join Date
    Mar 2012
    Posts
    9

    Default

    Oleg,

    Sorry, I guess I misunderstood the attribute.

    Setting expire-groups-upon-completion="true" worked!

    Thanks for your help.

    Steve

  6. #6
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

    Hello

    Let me explain it shortly too:
    Result of CorrelationStrategy is presented as MessageGroupId. So, your ReleaseStrategy marks that group as compleat and doesn't aggregate it again in the default case - expire-groups-upon-completion="false"

    Cheers,
    Artem Bilan

  7. #7
    Join Date
    Mar 2012
    Posts
    9

    Default

    Artem,

    Thanks for the explanation. It was very helpful.

    Hopefully, it will be documented as well in the reference manual soon. ;-)

    Steve

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •