I'm developing a multi property micro service by spring integration. I'm getting each property's login credentials from database like LOGIN table. LOGIN table has these fields; LOGIN.username, LOGIN.pass and LOGIN.period(poller's period). If I want to make work the micro service with different poller configurations based on LOGIN.period field, how can I do that?
@Bean
public IntegrationFlow start() {
return IntegrationFlows
.from(() -> DAO.getLoginList()) // from a web service.
.split() // splits the each login credentials for each property.
.channel("X_CHANNEL") // subscribes to a channel todo business logic.
.get();
}
Is it possible to implement a component to make work flow in different poller configurations based on the LOGIN.period value from database?
Show, please, how you get that info from the data base.
But if your point that you may have several records in DB and you want to have several pollers for all of them, then you need to take a look dynamic flow registrations: https://docs.spring.io/spring-integration/docs/5.3.2.RELEASE/reference/html/dsl.html#java-dsl-runtime-flows
So, you read data from the DB, create
IntegrationFlow
in the loop for every record and configure their pollers according the data from the record.