Edited I am new to Spring integration, and I am trying to pass data from a service activator(via handle method) to a channel.
@Bean
public IntegrationFlow processFileFlow() {
return IntegrationFlows
.from("fileInputChannel")
.transform(fileToStringTransformer())
.handle("fileProcessor", "process")
.channel("xmlChannel")
.get();
}
@Bean
public DirectChannel fileInputChannel(){
return new DirectChannel();
}
@Bean
public DirectChannel xmlChannel(){
return new DirectChannel();
}
@Bean
public FileProcessor fileProcessor() {
return new FileProcessor();
}
@Bean
public IntegrationFlow enrichDataFlow() {
return IntegrationFlows
.from("xmlChannel")
.handle("enricher", "enrichProduct")
.channel("bvChannel")
.get();
}
@Bean
public Enricher enricher() {
return new Enricher();
}
This is the FileProcessor class
public class FileProcessor {
@ServiceActivator(outputChannel = "xmlChannel")
public String process(Message<String> msg) {
String content = msg.getPayload();
return content;
}
}
This is the Enricher class: public class Enricher {
public void enrichProduct(Message<String> msg) {
System.out.println("Enriching product " + msg);
}
}
The message "Enriching product .." isn't getting printed, and I'm not really sure of what has gone wrong.