GH-8692 Add createIndexes to MongoDbMessageStore
Fixes https://github.com/spring-projects/spring-integration/issues/8692 * Added `createIndexes` in `AbstractConfigurableMongoDbMessageStore` * Added Javadoc for `setCreateIndex()` method * Removed `afterPropertiesSet()` in `MongoDbChannelMessageStore` and update `whats-new.adoc` and `mongodb.adoc` files **Cherry-pick to `6.1.x` & `6.0.x`**
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.integration.mongodb.store;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bson.Document;
|
||||
@@ -25,6 +26,8 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.data.convert.ReadingConverter;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.index.IndexInfo;
|
||||
import org.springframework.integration.IntegrationMessageHeaderAccessor;
|
||||
import org.springframework.integration.channel.PriorityChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
@@ -42,6 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Amol Nayak
|
||||
* @author Artem Bilan
|
||||
* @author Artem Vozhdayenko
|
||||
* @author Adama Sorho
|
||||
*
|
||||
*/
|
||||
class ConfigurableMongoDbMessageGroupStoreTests extends AbstractMongoDbMessageGroupStoreTests {
|
||||
@@ -134,6 +138,12 @@ class ConfigurableMongoDbMessageGroupStoreTests extends AbstractMongoDbMessageGr
|
||||
.getClass());
|
||||
context.refresh();
|
||||
|
||||
List<IndexInfo> indexesInfo =
|
||||
new MongoTemplate(MONGO_DATABASE_FACTORY)
|
||||
.indexOps("customConverterCollection")
|
||||
.getIndexInfo();
|
||||
assertThat(indexesInfo).hasSize(0);
|
||||
|
||||
TestGateway gateway = context.getBean(TestGateway.class);
|
||||
String result = gateway.service("foo");
|
||||
assertThat(result).isEqualTo("FOO");
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
<beans:bean id="messageStore" parent="abstractMessageStore">
|
||||
<beans:constructor-arg name="mappingMongoConverter" ref="customConverter"/>
|
||||
<beans:constructor-arg name="collectionName" value="customConverterCollection"/>
|
||||
<beans:property name="createIndexes" value="false" />
|
||||
</beans:bean>
|
||||
|
||||
<gateway id="gateway"
|
||||
|
||||
Reference in New Issue
Block a user