Results 1 to 5 of 5

Thread: Passing a list of Messages to @MessageEndpoint

  1. #1
    Join Date
    Oct 2006
    Posts
    11

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

    Thanks

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

    Default

    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?

    Thanks,
    Mark

  3. #3
    Join Date
    Oct 2006
    Posts
    11

    Default

    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. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    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. #5
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    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.

    http://forum.springsource.org/showth...ator+timeou t
    http://forum.springsource.org/showthread.php?t=71599

Posting Permissions

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