Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-3087

MongoDb message store deleting messages from wrong group



      This issue happens when you put the same message (ie. same UUID) onto more than one channel at the same time and the channels are backed by the MongoDb message store.

      The message gets inserted to mongo correctly with a groupId representing the channel name. The polling is also correct, it returns the oldest message for a particular groupId:

      Query q = new Query(where(GROUP_ID_KEY).is(groupId)).limit(1);
      q.with(new Sort(Direction.ASC, CREATED_DATE));

      However, when pollMessageFromGroup finds a message it then tries to delete it by calling removeMessage(UUID id). The problem is that this method does not take into account the groupId. It just deletes a single message in the collection with that id. If there are more than one message in the collection with that id, the correct message might not get deleted.

      We saw this happening in one of our services. When we sent the same message to two different channels it would sometimes get handled twice by the service activator for one channel and zero times for the other channel's service activator. The problem obviously gets worse if you send the same message to more than two channels.


          Issue Links



              • Assignee:
                grussell Gary Russell
                jodiestjohn Jodie St. John
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: