首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IntegrationFlow +2条件变压器+出站网关

IntegrationFlow +2条件变压器+出站网关
EN

Stack Overflow用户
提问于 2020-08-24 19:44:36
回答 1查看 394关注 0票数 0

我有一个集成流程,它需要基于某种条件运行一个转换器或另一个转换器,然后在出站网关上发布一个http请求。

代码语言:javascript
复制
@Bean
public IntegrationFlow messageFromKafka() {
    return flow -> flow
            .publishSubscribeChannel(s -> s
                    .subscribe(f1 -> f1
                            .<AttachmentEvent>filter(validator::isCondition1)
                            .transform(transformer1)
                    )
                    .subscribe(fl -> fl
                            .<AttachmentEvent>filter(validator::isCondition2)
                            .transform(transformer2)
                            .split()
                    )
            )
            .publishSubscribeChannel(s -> s
                    .subscribe(fl1 -> fl1
                            .transform(httpTransformer)
                            .<String, String>route(transformedMessage -> getFlowType(transformedMessage), mapping -> mapping
                                    .subFlowMapping("operation1", sf -> sf
                                            .handle(getOAuth2Handler(HttpMethod.PUT, "http://localhost:8080/test"))
                                    )
                                    .subFlowMapping("operation2", sf -> sf
                                            .<String>filter(message -> isVendorStatusDescNotCancelled(message))
                                            .handle(getOAuth2Handler(HttpMethod.PUT, "http://localhost:8080/test2"))
                                    )
                                    .subFlowMapping("operation3", sf -> sf
                                            .handle(getOAuth2Handler(HttpMethod.PUT, "http://localhost:8080/test3"))
                                    )
                            )
                    )
                    .subscribe(fl2 -> fl2
                            .handle(getKafkaHandler())
                    )
            );
}  

这是我的尝试,但我得到了这个错误信息“没有输出通道或replyChannel头可用”,我认为我理解为什么,但不确定如何实现我所需要的。

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-08-24 20:06:32

在集成中,使用router模式:https://docs.spring.io/spring-integration/docs/5.3.2.RELEASE/reference/html/message-routing.html#messaging-routing-chapter处理条件流

尽管看起来您的问题与条件解决完全无关。

我认为您的每个handle(getOAuth2Handler(...))都返回一些在这些子流中不作为答复处理的值。如果您对这个答复不感兴趣,可以考虑在nullChannel之后为那些子流配置一个handle()

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63567762

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档