use of org.springframework.integration.store.AbstractBatchingMessageGroupStore in project spring-integration by spring-projects.
the class AbstractMongoDbMessageGroupStoreTests method testAddAndRemoveMessagesFromMessageGroup.
@Test
@MongoDbAvailable
public void testAddAndRemoveMessagesFromMessageGroup() throws Exception {
MessageGroupStore messageStore = (MessageGroupStore) this.getMessageStore();
String groupId = "X";
messageStore.removeMessageGroup("X");
((AbstractBatchingMessageGroupStore) messageStore).setRemoveBatchSize(10);
List<Message<?>> messages = new ArrayList<Message<?>>();
for (int i = 0; i < 25; i++) {
Message<String> message = MessageBuilder.withPayload("foo").setCorrelationId(groupId).build();
messageStore.addMessagesToGroup(groupId, message);
messages.add(message);
}
MessageGroup group = messageStore.getMessageGroup(groupId);
assertEquals(25, group.size());
messageStore.removeMessagesFromGroup(groupId, messages);
group = messageStore.getMessageGroup(groupId);
assertEquals(0, group.size());
}
Aggregations