Results 1 to 9 of 9

Thread: SequenceSizeComparator

  1. #1
    Join Date
    Jun 2008
    Location
    Zurich, Switzerland - Freiburg i. Breisgau, Germany
    Posts
    102

    Lightbulb SequenceSizeComparator

    Since an aggregator may get messages from different channels it would be great to have a comparator for sorting the incoming messages.

    Cheers Tai

  2. #2
    Join Date
    Jun 2008
    Location
    Zurich, Switzerland - Freiburg i. Breisgau, Germany
    Posts
    102

    Default Correction: number not size

    Of course I mean a SequenceNumberComparator

  3. #3
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,854

    Default

    There is a <resequencer/> as well, and its role is very similar to Aggregator except that it does not combine the incoming Messages into a single Message. It does, however, re-order the Messages according to the sequenceNumber value. Have you tried using that?

  4. #4
    Join Date
    Jun 2008
    Location
    Zurich, Switzerland - Freiburg i. Breisgau, Germany
    Posts
    102

    Thumbs up

    Great! I will try that.

    Thanks Tai

  5. #5
    Join Date
    Jun 2008
    Location
    Zurich, Switzerland - Freiburg i. Breisgau, Germany
    Posts
    102

    Question

    And how do I configure the resequencer? It seems I cannot add that to an aggregator.

    I tried this:
    <resequencer input-channel="requestChannel"/>

    But that seems not to work.

  6. #6
    Join Date
    Oct 2007
    Location
    Toronto, ON
    Posts
    90

    Default

    Tai,

    The <resequencer/> does not get added to an <aggregator/>, you would have to use it instead of the <aggregator/> (with the same input/output channels that you intended to use there).

    Regards,
    Marius
    Marius Bogoevici,
    Spring Integration Committer

  7. #7
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    Quote Originally Posted by mbogoevici View Post
    Tai,
    The <resequencer/> does not get added to an <aggregator/>, you would have to use it instead of the <aggregator/> (with the same input/output channels that you intended to use there).
    To be a bit more precise you would use a resequencer AND an aggregator as two separate endpoints. The resequencer passes messages in sequence, where the aggregator combines multiple messages into one.

  8. #8
    Join Date
    Jun 2008
    Location
    Zurich, Switzerland - Freiburg i. Breisgau, Germany
    Posts
    102

    Exclamation

    Ok. Let me be more precise. I already thought that I have to use a resequencer first and then an aggregator. Like this:

    Code:
    	<resequencer id="csvResequencer" input-channel="rowChannel" output-channel="resequencerChannel"/>
    
    	<aggregator id="csvToAdaptersTranslatorServiceActivator" input-channel="resequencerChannel" output-channel="adapterChannel"
    		ref="csvToAdaptersTranslator" method="translate">
    	</aggregator>
    But as I can already see in eclipse it is complaining that: "Attribute 'input-channel' is not allowed to appear in element resequencer".

    Trying to read the configuration of course I get the following:
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'input-channel' is not allowed to appear in element 'resequencer'.
    at org.apache.xerces.util.ErrorHandlerWrapper.createS AXParseException(Unknown Source)
    at org.apache.xerces.util.ErrorHandlerWrapper.error(U nknown Source)

  9. #9
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,854

    Default

    This issue has been resolved on the SVN head. I added an issue so that others who encounter this will be able to find it in JIRA: http://jira.springframework.org/browse/INT-406

    If you are unable to upgrade to the head version, know that we are aiming for RC1 at the end of next week. I believe in the meantime you can add a resequencer element's id as a "ref" value within a <service-activator/>. That is admittedly clunky, but here's what the (more consistent) head version of "resequencerParserTests.xml" looks like:
    Code:
      <resequencer id="completelyDefinedResequencer" 
    		input-channel="inputChannel2"
    		output-channel="outputChannel" 
    		discard-channel="discardChannel"
    		send-timeout="86420000" 
    		send-partial-result-on-timeout="true"
    		reaper-interval="135" 
    		tracked-correlation-id-capacity="99"
    		timeout="42" 
    		release-partial-sequences="false"/>

Posting Permissions

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