Hello guys
I am working and testing the section Configuring a Router with Annotations where appear the follow snippet code
I tested each approach about the return type but the second does not work@Router
public MessageChannel route(Message message) {...}
@Router
public List<MessageChannel> route(Message message) {...}
@Router
public String route(Foo payload) {...}
@Router
public List<String> route(Foo payload) {...}
For example if I work with List<String>
It work fineCode:<int:router id="router" input-channel="inicio" apply-sequence="true" method="metodoRouter01" ref="myRouterSinAnnotationTres" /> private List<String> listChannels; public MyRouterConAnnotationTres(){ listChannels = new ArrayList<String>(); listChannels.add("dvdChannel"); listChannels.add("instrumentoMusicalChannel"); } @Router public List<String> metodoRouter01(Message<?> message){ logger.info("... message: {}", message); return listChannels; }
But If I work with List<MessageChannel>
does not work I dont receive none exceptionCode:<int:router id="router" input-channel="inicio" apply-sequence="true" method="metodoRouter01" ref="myRouterSinAnnotationCuatro" /> private List<MessageChannel> listChannels; private DirectChannel dvdChannel; private DirectChannel instrumentoMusicalChannel; @Value("#{dvdChannel}") public void setDvdChannel(DirectChannel dvdChannel) { this.dvdChannel = dvdChannel; } @Value("#{instrumentoMusicalChannel}") public void setInstrumentoMusicalChannel(DirectChannel instrumentoMusicalChannel) { this.instrumentoMusicalChannel = instrumentoMusicalChannel; } public MyRouterSinAnnotationCuatro(){ listChannels = new ArrayList<MessageChannel>(); listChannels.add(dvdChannel); listChannels.add(instrumentoMusicalChannel); } public List<MessageChannel> metodoRouter01(Message<?> message){ logger.info("... message: {}", message); return listChannels; }
How I know it does not work?, simply I have two flow integration files
one working with List<String> and the second with List<MessageChannel>, each file has
For the case with List<String> I can see through the history for each Message sent, the follow history:Code:<int:message-history/> <int:wire-tap pattern="*" channel="logger" /> <int:logging-channel-adapter id="logger" level="INFO" log-full-message="true" />
startChannel, router->outputchannel, some ServiceActivator, finalChannel
But with List<MessageChannel> I can see only the follow history for each Message sent it, everyone has the follow sequence:
startChannel, router->XXX
I mean with XXX that each Message<T> never left the router, what is wrong?
I have the same weird behaviour even If I work with List<DirectChannel>
Thanks in advanced


Reply With Quote