I have the following use case:
1. Splitter bean: incoming String is splitted and returned
2. Pass bean: that just returns the incoming payload
3. Aggregator bean: a logger that expects to get ALL strings to log them
The SplitAggregate.xml looks like this:
The Split class:Code:<message-bus /> <channel id="inputChannel"/> <channel id="passChannel"/> <channel id="logChannel"/> <splitter id="splitterEndpoint" input-channel="inputChannel" output-channel="passChannel" ref="splitter" method="split" /> <beans:bean id="splitter" class="test.Split"> </beans:bean> <service-activator id="passEndpoint" input-channel="passChannel" output-channel="logChannel" ref="pass" method="pass"/> <beans:bean id="pass" class="test.Pass"> </beans:bean> <aggregator id="aggregator" input-channel="logChannel" ref="logAll" method="log" /> <beans:bean id="logAll" class="test.LogAll"> </beans:bean>
The Pass class:Code:package test; public class Split { public String[] split(String payload) { return payload.split(","); } }
The LogAll class:Code:package test; public class Pass { public String pass(String payload) { return payload; } }
To start the Demo:Code:package test; import java.util.List; public class LogAll { public void log(List<String> payloads) { System.out.println(">>>" + payloads); } }
The error message I get is:Code:package test; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.channel.ChannelRegistry; import org.springframework.integration.channel.MessageChannel; import org.springframework.integration.config.MessageBusParser; import org.springframework.integration.message.GenericMessage; public class Demo { /** * @param args */ public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("SplitAggregate.xml", Pass.class); context.start(); ChannelRegistry channelRegistry = (ChannelRegistry) context.getBean(MessageBusParser.MESSAGE_BUS_BEAN_NAME); MessageChannel channel = channelRegistry.lookupChannel("inputChannel"); channel.send(new GenericMessage<String>("1,2,3,4")); } }
Here the return message is null that causes this exception.Caused by: java.lang.NullPointerException
at org.springframework.integration.aggregator.Aggrega tingMessageHandler.processReleasedMessages(Aggrega tingMessageHandler.java:91)
I have attached also the source code in a zip file. Should I create a Jira entry for this?


Reply With Quote
