gpt4 book ai didi

java - 相当于 的 Spring Integration DSL

转载 作者:行者123 更新时间:2023-11-29 04:27:34 25 4
gpt4 key购买 nike

什么是 Spring Integration DSL 创建等价物的方式

<int:gateway service-interface="MyService" default-request-channel="myService.inputChannel"/>

// where my existing interface looks like
interface MyService { process(Foo foo); }

我无法在 org.springframework.integration.dsl 中找到工厂,并且 IntegrationFlows.from(...) 的参数列表都没有帮助 self 发现。

感觉好像我缺少了一些东西,比如来自 https://github.com/spring-projects/spring-integration-java-dsl/wiki/Spring-Integration-Java-DSL-Reference#using-protocol-adaptersJava 协议(protocol)适配器。 .

// I imagine this is what I can't find
IntegrationFlows.from(Java.gateway(MyService.class)
.channel("myService.inputChannel")
.get();

我唯一遇到的事情是在一篇旧博客文章中,但它似乎需要用 @MessagingGateway@Gateway 注释界面,我我想避免。参见 https://spring.io/blog/2014/11/25/spring-integration-java-dsl-line-by-line-tutorial

最佳答案

我们最近在 Spring Integration 5.0 中做到了这一点。有了它,你真的可以做到这一点:

@Bean
public IntegrationFlow controlBusFlow() {
return IntegrationFlows.from(ControlBusGateway.class)
.controlBus()
.get();
}

public interface ControlBusGateway {

void send(String command);
}

查看最新blog post中的更多信息.

现在您别无选择,除非在接口(interface)上声明 @MessagingGateway 并从该网关定义的请求 channel 启动流程。

关于java - 相当于 <int :gateway . ../> 的 Spring Integration DSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45484397/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com