Giriş
Açıklaması şöyle
A Splitter takes a single message and splits it into multiple messages based on specific criteria.
Örnek
Şöyle yaparız
@Configuration public class SplitterConfig { @Bean public MessageChannel inputChannel() { return new DirectChannel(); } @Bean public MessageChannel outputChannel() { return new DirectChannel(); } @Bean @Splitter(inputChannel = "inputChannel", outputChannel = "outputChannel") public AbstractMessageSplitter splitter() { return new AbstractMessageSplitter() { @Override protected List<?> splitMessage(Message<?> message) { return Arrays.asList(message.getPayload().toString().split(",")); } }; } }
In this configuration, we define two DirectChannel beans: inputChannel and outputChannel. We also define a Splitter that splits the message payload into multiple messages based on the comma delimiter and sends them to the outputChannel.
Hiç yorum yok:
Yorum Gönder