Announcement Announcement Module
Collapse
No announcement yet.
Multithreaded Resequencer with sequence key Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multithreaded Resequencer with sequence key

    Hi,

    Please, help to implement next use case with Spring Integration:

    I need to process messages coming to channel in multiple threads but messages with same sequence key (can be calculated via XPath expression on message body) should be processed strictly sequentially.

    Are there any ways to do it with existing patterns, please, advise what classes to look for this functionality for.

    Thanks is advance.

  • #2
    Have you looked at the Priority Channel? http://static.springsource.org/sprin...mplementations

    Comment


    • #3
      Thanks for quick reply Oleg.

      So if I will configure priority channel:

      Code:
      <channel id="simpleChannel">
          <priority-queue capacity="100" comparator="com.xxx.OrderProcessingComparator"/>
      </channel>
      Does it means if I configure multi-threaded consuming on this channel - messages which are equal according to OrderProcessingComparator#compare() can be processed simultaneously?

      Comment


      • #4
        Actually thinking about it more, priority channel is not what you need. How many different combinations of this 'sequence key' can you have? Is it totally arbitrary or is it something more controlled and in the range of let's say 5-10 different combinations?

        Comment


        • #5
          Hi Oleg,

          Thank you for supporting.

          Sequence key is just some specific value inside document body - this is some way to group documents together with the requirement that documents from 1 group should be processed 1-by-1 (order does not matter) but documents from different groups can be processed simultaneously.

          So sequence key is totally arbitrary and we don't have any specific range for this.
          Sequence key can be considered as "group id" to identify messages from same group.

          Comment


          • #6
            Let me sleep on it fro a few days. I need to think, but i'll definitely follow up.

            Comment


            • #7
              Thanks a lot, will be waiting for reply.

              Comment


              • #8
                If you don't hear from me, just ping on this thread and i'll get a reminder

                Comment


                • #9
                  Hi Oleg,

                  Do you have an idea on how to implement the desirable?

                  Thanks in advance for your help.

                  Comment


                  • #10
                    Hi Oleg,

                    If you will have an idea on this, please, reply.

                    Thanks.

                    Comment


                    • #11
                      Sorry, on vacation. Give me till next week

                      Comment


                      • #12
                        . .

                        Comment


                        • #13
                          Sorry, took me a while to get to it. I'll let you know by tomorrow. There are many ways of solving it, but I am now thinking about making it a part of the framework, so its a bit tricky. I'll let you know. I have a working prototype so i'll share it with you one way or the other.

                          Comment


                          • #14
                            Thank you.

                            Comment


                            • #15
                              Hey, sorry about the delay, but it was a bit trickier than I thought. Anyway, take a look at this: https://jira.springsource.org/browse/INT-2108. Currently the code is on my branch. You are more then welcome to checkout and build or you can just copy and paste the code itself in your classes.
                              It would be interesting to get your feedback.

                              Comment

                              Working...
                              X