Results 1 to 6 of 6

Thread: Resequencer with sequence number not beginning at 1

  1. #1
    Join Date
    Jun 2011
    Posts
    5

    Default Resequencer with sequence number not beginning at 1

    Hi,

    Is it possible with a resequencer to have sequence number not beginning at 1 ?
    The use case is the following : I will listen to a JMSQueue (on whom I have no control) and extract sequenceNumber from message payload in the queue, so I can't guarantee that, when my application launches, the next message in the queue has the sequenceNumber 1.

    Thanks,

    Mayeul

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,028

    Default

    Not out-of-the-box.

    The problem is: Let's say you start with 2; how does the resequencer know that you started with 2, Vs. waiting for the late arrival of sequence 1??

    You would need some mechanism (outside of the framework) to tell a customized resequencer not to expect sequences less than some arbitrary number, that might change each time the application starts.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Jun 2011
    Posts
    5

    Default

    Hi Gary,

    Thanks you for your (very fast) reply.
    How could I customized the resequencer?
    I was thinking of overriding the default message store to handle MessageGroup creation myself, and by that mean setting the field SimpleMessageGroup.lastSequenceNumber myself.

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,028

    Default

    Unfortunately, it's not particularly easy to customize this component - you would need to create your own version of ResequencingMessageGroupProcessor. I still don't know how you will signal what is a "good" first message Vs. an out of sequence message, though.

    That said, if your sequence numbers are consecutive - i.e. the last one you processed was 25 and the next time you start your app, you'll get 26 then you can simply use a persistent message store (e.g. Redis, JDBC etc) and all should work ok.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  5. #5
    Join Date
    Jun 2011
    Posts
    5

    Default

    Nop, messages coul be lost ou timeouted in the incoming queue.
    How could I tell the resequencer to use my own version of ResequencingMessageGroupProcessor?
    To get a candidate for a "good" first message i will wait a certain amount of time and then, choose the message with the smallest id.

  6. #6
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,028

    Default

    You will have to forego the namespace support, use <bean/> syntax to create a ResequencingMessageHandler, passing your ResequencingMessageGroupProcessor into it via a <constructor-arg/>.

    You would then need to add your handler to a ConsumerEndpointFactoryBean <bean/>.

    (I said it wasn't "easy")

    You should examine the ResequencerParser, AbstractCorrelatingMessageHandlerParser, and AbstractConsumerEndpointParser to figure out exactly how to configure these components.


    We hope to make it easier to wire up these components using Java (as well as Scala and Groovy) as time permits.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Posting Permissions

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