简体   繁体   English

打破 Transformer 流程​​ Spring 集成

[英]Break the Transformer flow Spring Integration

I have spring integration flows.我有 Spring 集成流程。 One for the file poller and other one is to process the file一个用于文件轮询器,另一个用于处理文件

flow # 01流#01

poll the file in C:/testing directory轮询 C:/testing 目录中的文件

files comes goes to "process" queue文件进入“处理”队列

flow # 02 (from "process")流程#02(来自“流程”)

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.问题是,如果FindTheDepartItBelongs找不到部门,那么它必须停止其余的流程并将消息发送到某个错误队列。

If I return null from the transformer it does not work.如果我从变压器返回 null 它不起作用。

Is there any other way to achieve the same ?有没有其他方法可以实现相同的目标?

A transformer cannot return null , but a .handle() method can and the flow just stops.转换器不能返回null ,但.handle()方法可以并且流程停止。 It won't go to the error channel, though;但是,它不会进入错误通道; you have to throw an exception for that.你必须为此抛出一个异常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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