Announcement Announcement Module
Collapse
No announcement yet.
Resequencer with sequence number not beginning at 1 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment


        • #5
          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.

          Comment


          • #6
            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.

            Comment

            Working...
            X