Referencing rather ancient question Spring Integration "Publish Subscribe Channel" with Spring DSL, I need to know wether it is possible to determine / declare the order of which subscribers of a publish/subscriber-channel will be called.
Reason: I am receiving files from a remote directory to transfer them into a database and delete afterwards. Of course, deletion shall only happen, if writing to the database completed successfully.
Code from referenced question is:
@Bean
public SubscribableChannel httpInAdapterPubSubChannel()
{
return MessageChannels.publishSubscribe("httpInAdapterPubSubChannel")
.get();
}
@Bean
public IntegrationFlow subscriber1() {
return IntegrationFlows.from(httpInAdapterPubSubChannel())
.handle( message -> System.out.println("Enrich Headers based on Payload...."))
.get();
}
@Bean
public IntegrationFlow subscriber2() {
return IntegrationFlows.from(httpInAdapterPubSubChannel())
.handle( message -> System.out.println("Save Payload to Audit Table..."))
.get();
}