Announcement Announcement Module
No announcement yet.
Running out of capacity when using SimpleMessageStore. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Running out of capacity when using SimpleMessageStore.

    We are using the latest version of Spring-Integration.

    We are using the Aggregation capability of Spring Integration. We are using the default aggregator, and have defined a CorrelationStrategy pojo, ReleaseStrategy pojo, a SimpleMessageStore for aggregating messages, a MessageGroupStoreReaper (although currently there are no messages to be reaped).

    All works as we expect except that the MessageStore runs out of capacity. It appears that although messages are being released, they are not being removed from the store. We have tested with a capacity of 15 and with a capacity of 100. The only difference is in how long it takes before the “out of capacity” exception is thrown.
    Messages are aggregated correctly.

    Documentation says “When the group is released for aggregation, all its unmarked messages are processed and then marked so they will not be processed again. If the group is also complete (i.e. if all messages from a sequence have arrived or if there is no sequence defined), then the group is removed from the message store. Partial sequences can be released, in which case the next time the ReleaseStrategy is called it will be presented with a group containing marked messages (already processed) and unmarked messages (potentially a new partial sequence).”

    In our case, there is no sequence defined, so therefore the messagegroup should have been removed. I verified that no sequence is defined by examining the headers for each message sent to the correlationStrategy and found no SEQUENCE_SIZE or SEQUENCE_NUMBER header.

    Any assistance would be welcome.

  • #2
    Using Spring source code, I debugged the problem. The MessageGroup was being removed. I had assumed it wasn't because capacity was being depleted.
    The problem was in how an underlying "upperbound" semaphore was being acquired and released. The semaphore's value was set to the capacity value. The semaphore was acquired each time a message was added to a group. There were twelve messages per group in my use case. A single semaphore was released when the group was removed. This guarantees eventual failure.

    2 solutions come to mind: 1) Extend the SimpleMessageStore and fix any methods causing the problem, or 2) set capacity to 0 which would effectively disable the use of the semaphore. Initially I did not set capacity to 0 because I was assuming that groups were being accumulated and never be removed from the store.


    • #3
      Thanks for the debugging. The fix was easy ( I guess you could run with capacity=0 until the fix is released, or else patch your jar, or use a snapshot.
      Last edited by Dave Syer; Mar 24th, 2011, 03:15 AM. Reason: Wrong URL