Java – Breaks the Transformer process Spring Integration

Breaks the Transformer process Spring Integration… here is a solution to the problem.

Breaks the Transformer process Spring Integration

I have the Spring Integration process. One for the file poller and the other for processing files

Process # 01

Poll the files in the C:/testing directory

The file goes into the Processing queue


#02 (from “Process”).

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

The problem is that if FindTheDepartItBelongs cannot find the department, then it must stop the rest of the process and send the message to some error queue.

If I return null from the converter, it doesn’t work.

Are there other ways to achieve this?


The converter cannot return null, but the .handle() method does, and the process stops. It doesn’t go into the error channel, though; You have to throw an exception for this.

Related Problems and Solutions