I have a requirement like
At thie point I am thinking about have one flow that will deal with FTP side and get the file and download it.
flow # 02 will pick the file and do the processing as explained above
My question is should I be using the transformers for all these steps above. Also is it ok if I have one flow with all the transformers or should I break it down in sub-flows?.
If any transformer throws an exception will it just ignore the rest of transformers and go to error channel?
Also if I put an exception handling channel will I actually know at which step the exception was thrown?
You really can do everything with transformers if you are not familiar with many other Spring Integration components, like Enricher
: https://docs.spring.io/spring-integration/reference/html/message-transformation.html#content-enricher and JPA channel adapters: https://docs.spring.io/spring-integration/reference/html/jpa.html#jpa
You really can do everything in a single flow even if you are going to have several instances of your application. It is possible to configure a flow the way that every step can be distributed to the whole cluster for even computation. On the other hand I really split my flow to several of them for some logical units.
If one step throws exception, you indeed don't go downstream with that message any more. This works exactly the same way as regular Java program.
Yes, starting with some version we add a whole component into an exception message:
throw IntegrationUtils.wrapInHandlingExceptionIfNecessary(messageToUse,
() -> "error occurred in message handler [" + this + "]", e);
Pay attention to this
. It will call toString()
with a bean name and a configuration source to determine the place from the exception where in the flow an error happened.