简体   繁体   中英

Break the Transformer flow Spring Integration

I have spring integration flows. One for the file poller and other one is to process the file

flow # 01

poll the file in C:/testing directory

files comes goes to "process" queue

flow # 02 (from "process")

Transformer(new FindTheDepartItbelongs()) //basically file has to match to some depoartment
.transform(new FileParserTransformer()
.transformer(new CustomerTransformer()
.handle (o -> {})

The issue is if the FindTheDepartItBelongs cannot find the department then it has to stop the rest of the flow and send the message to some error queue.

If I return null from the transformer it does not work.

Is there any other way to achieve the same ?

A transformer cannot return null , but a .handle() method can and the flow just stops. It won't go to the error channel, though; you have to throw an exception for that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM