use of org.springframework.integration.splitter.AbstractMessageSplitter in project spring-integration by spring-projects.
the class CollectionAndArrayTests method setWithSplittingHandler.
@Test
public void setWithSplittingHandler() {
AbstractMessageSplitter handler = new AbstractMessageSplitter() {
@Override
protected Object splitMessage(Message<?> message) {
return new HashSet<String>(Arrays.asList(new String[] { "foo", "bar" }));
}
};
QueueChannel channel = new QueueChannel();
Message<?> message = MessageBuilder.withPayload("test").setReplyChannel(channel).build();
handler.handleMessage(message);
Message<?> reply1 = channel.receive(0);
Message<?> reply2 = channel.receive(0);
assertNotNull(reply1);
assertNotNull(reply2);
assertEquals(String.class, reply1.getPayload().getClass());
assertEquals(String.class, reply2.getPayload().getClass());
}
Aggregations