use of org.springframework.integration.annotation.Splitter in project spring-integration by spring-projects.
the class StreamingSplitterTests method splitToIterator_allMessagesContainSequenceNumber.
@Test
public void splitToIterator_allMessagesContainSequenceNumber() throws Exception {
final int messageQuantity = 5;
MethodInvokingSplitter splitter = new MethodInvokingSplitter(new IteratorTestBean(messageQuantity));
DirectChannel replyChannel = new DirectChannel();
splitter.setOutputChannel(replyChannel);
new EventDrivenConsumer(replyChannel, message -> assertThat("Failure with msg: " + message, message.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, Integer.class), is(Integer.valueOf((String) message.getPayload())))).start();
splitter.handleMessage(message);
}
use of org.springframework.integration.annotation.Splitter in project spring-integration by spring-projects.
the class StreamingSplitterTests method splitWithMassiveReplyMessages_allMessagesSent.
@Test
public void splitWithMassiveReplyMessages_allMessagesSent() throws Exception {
final int messageQuantity = 100000;
MethodInvokingSplitter splitter = new MethodInvokingSplitter(new IteratorTestBean(messageQuantity));
DirectChannel replyChannel = new DirectChannel();
splitter.setOutputChannel(replyChannel);
final AtomicInteger receivedMessageCounter = new AtomicInteger(0);
new EventDrivenConsumer(replyChannel, message -> {
assertThat("Failure with msg: " + message, message.getPayload(), is(notNullValue()));
receivedMessageCounter.incrementAndGet();
}).start();
splitter.handleMessage(message);
assertThat(receivedMessageCounter.get(), is(messageQuantity));
}
Aggregations