Reputation: 123
I have two IntegrationFlows for importing Head and Position Data. For importing I use csv-Files, which are organized in a folder structure. The Head-CSV-Files, are in the Head-Folder and die Position-Files in the Position-Folder. The structure of the csv-Files is of course different.
Now it is necessary, that the Head-Data are getting imported before the Position Data. But when no Head Data available, the Position-Folder should be processed anyway. (E.g. for an Position Update of an existing Head)
Currently I have two IntegrationFlows. One for each case.
Is there a possibility to call this Integrationflows one after another? If not, is there any possibility (maybe over the aggregation method), to use two different MessageSources by one IntegrationFlow, with the possibility to detect if it is an Head or an Position and the safety, that the Head-Message-Source is proceeded bevore the Position?
@Configuration
public class MyHeadFlowConfig
@Bean
public IntegrationFlow myHeadFlow() {
return IntegrationFlows.from(myHeadMessageSource, myPollerConsumer))
.filter(new SimplePatternFileListFilter("*.csv"))
.handle(myHeadJobConfig)
.get();
}
}
@Configuration
public class MyPositionFlowConfig
@Bean
public IntegrationFlow myPositionFlow() {
return IntegrationFlows.from(myPositionMessageSource, myPollerConsumer))
.filter(new SimplePatternFileListFilter("*.csv"))
.handle(myPositionJobConfig)
.get();
}
}
Upvotes: 0
Views: 243
Reputation: 6106
There are many ways you can accomplish this.
If the two integration flows are running in the same JVM, the simplest and the most natural approach would be to share a channel . Basically create an instance of MessageChannel
and wire it at the end of one floe and the beginning of another.
floaA -> sharedChannel -> flowB
ApplicationEvent support would be another approach. And of course bunch of provided Inbound/Outbound adapters.
Upvotes: 1