GH-8732 Don't remove JDBC message if other groups (#8733)

* GH-8732 Don't remove JDBC message if other groups

Fixes https://github.com/spring-projects/spring-integration/issues/8732

When same message is added into different groups,
its record in the `INT_MESSAGE` must remain until the last group is removed

* Improve `JdbcMessageStore.DELETE_MESSAGES_FROM_GROUP` SQL
to ignore those messages for removal which has other group records in the `INT_GROUP_TO_MESSAGE` table

**Cherry-pick to `6.1.x`, `6.0.x` & `5.5.x`**

* * Fix `JdbcMessageStore.removeMessage()` and `removeMessagesFromGroup()`
to remove from `INT_MESSAGE` only if there is no other records in `INT_GROUP_TO_MESSAGE`

* * Improve `MessageStore.removeMessage()` Javadoc
mentioning `MessageGroupStore` specifics
This commit is contained in:
Artem Bilan
2023-09-14 12:58:07 -04:00
committed by GitHub
parent 73ed3eeebd
commit df67c59f8e
3 changed files with 56 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,11 +62,12 @@ public interface MessageStore {
<T> Message<T> addMessage(Message<T> message);
/**
* Remove the Message with the given id from the MessageStore, if present, and return it. If no Message with that id
* is present in the store, this will return <i>null</i>.
*
* @param id THe message identifier.
* @return The message.
* Remove the Message with the given id from the MessageStore, if present, and return it.
* If no Message with that id is present in the store, this will return {@code null}.
* If this method is implemented on a {@link MessageGroupStore},
* the message is removed from the store only if no groups holding this message.
* @param id the message identifier.
* @return the message (if any).
*/
Message<?> removeMessage(UUID id);