Is below the correct way to configure multiple independent IntegrationFlows in the same Spring Boot application? Is there any more optimization that could be done?
@Bean("flow1")
public IntegrationFlow integrationFlow1() {
return IntegrationFlows.from(jdbcMessageSource1(), p -> p.poller(pollerSpec1()))
.split()
.channel(c -> c.executor(Executors.newCachedThreadPool()))
.transform(transformer1, "transform")
.enrichHeaders(headerEnricherSpec -> headerEnricherSpec.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE))
.handle(Http.outboundGateway(url1)
.httpMethod(HttpMethod.POST)
.expectedResponseType(String.class)
.requestFactory(requestFactory))
.get();
}
@Bean("flow2")
public IntegrationFlow integrationFlow2() {
return IntegrationFlows.from(jdbcMessageSource2(), p -> p.poller(pollerSpec2()))
.split()
.channel(c -> c.executor(Executors.newCachedThreadPool()))
.transform(transformer2, "transform")
.enrichHeaders(headerEnricherSpec -> headerEnricherSpec.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE))
.handle(Http.outboundGateway(url2)
.httpMethod(HttpMethod.POST)
.expectedResponseType(String.class)
.requestFactory(requestFactory))
.get();
}