Announcement Announcement Module
No announcement yet.
Passing a list of Messages to @MessageEndpoint Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Passing a list of Messages to @MessageEndpoint

    Hi Folks,

    Is there any way that we can pass a list of messages to the bean annotated with @MessageEndpoint.

    Right now a method annotated w/@ServiceActivator is called once per message.


  • #2
    A Message can have a List (or any Collection) as its payload, but dealing with a List of Message objects would be a different problem because of the role of the Message headers.

    If a List-typed payload does not work for your particular use-case, can you describe it?



    • #3
      Thanks Mark for quick reply.

      In my case we would be polling for messages every (lets assume) 30 minutes, there is a good possibility that the queue would have around 1000s of messages once we pool it.

      There is some Database I/O involved per message, so we want to avoid this I/O and do one I/O operation as we process the 1000s of messages at once.


      • #4
        Okay. I think you have a few options. For a pure Spring Integration approach, you could use an Aggregator with a custom CorrelationStrategy and/or CompletionStrategy. You may be able to apply a header value to each Message and rely on default behavior (e.g. setting a correlation-id for each Message in a group).

        You might also want to consider using Spring Batch. Depending on the type of input, you might be able to use Spring Batch alone, or alternatively you may find that Spring Batch and Spring Integration together provides the best solution. That way you can create a "job" for the batch processing of DB operations.


        • #5
          I'm thinking that it might be very convenient to be able to aggregate messages without a correllation id (just aggregate every n messages). This has been discussed before iirc.