I've seen the issue about accessing flux at the middle of an IntegrationFlow and I wonder why I succeed writing logic inside the flux in the following way:
public void writeToSolr(IntegrationFlowDefinition<?> flowDefinition) {
flowDefinition
.bridge(e -> e.reactive(flux -> a ->
flux.log("write to solr")
.flatMap(writeToSolr)
.subscribe()));
}
I wonder first of all why I never get errors thrown to the console, but when debugging I see errors.
I also want to know how can this work and why do I need the a variable (that always produces NullPointerException, even though the flow can continue and work fine). When I omit the a variable:
public void writeToSolr(IntegrationFlowDefinition<?> flowDefinition) {
flowDefinition
.bridge(e -> e.reactive(flux ->
flux.log("write to solr")
.flatMap(writeToSolr)
.subscribe()));
}
I get an exception Bad return type in lambda expression: Disposable cannot be converted to Publisher<Message<?>> - e.g. code cant compile code due to types problem.