春季集成:一个人可以从标头浓度内调用网关吗?
我需要拨打通往网关的许多电话,然后将退货有效载荷放入标题。这些 Gateway 调用实际上是向有链条后面的通道发送消息。目前看起来像这样:
<int:channel id = "call_api_a" />
<int:chain input-channel = "call_api_a" >
...
</int:chain>
<int:channel id = "call_api_b" />
<int:chain input-channel = "call_api_b" >
...
</int:chain>
<int:gateway request-channel="call_api_a" />
<int:header-enricher>
<int:header name="a" expression="payload" />
</int:header-enricher>
<int:gateway request-channel="call_api_b" />
<int:header-enricher>
<int:header name="b" expression="payload" />
</int:header-enricher>
是否有一种优雅的方式将通话嵌入到标头enricher内部的网关?
类似:
<int:header-enricher>
<int:header name="a">
<int:gateway request-channel="call_api_a" />
</int:header>
</int:header-enricher>
我知道上述不起作用,但给人一种我想实现的意识。
感谢任何指示和最好的问候。
-aljo
I need to make a number of calls to gateways and to then place the return payloads into headers. These gateway calls are really sending a message to a channel behind which there is a chain. It currently looks like this:
<int:channel id = "call_api_a" />
<int:chain input-channel = "call_api_a" >
...
</int:chain>
<int:channel id = "call_api_b" />
<int:chain input-channel = "call_api_b" >
...
</int:chain>
<int:gateway request-channel="call_api_a" />
<int:header-enricher>
<int:header name="a" expression="payload" />
</int:header-enricher>
<int:gateway request-channel="call_api_b" />
<int:header-enricher>
<int:header name="b" expression="payload" />
</int:header-enricher>
Is there an elegant way to embed the call to the gateway inside of the header-enricher?
Something like:
<int:header-enricher>
<int:header name="a">
<int:gateway request-channel="call_api_a" />
</int:header>
</int:header-enricher>
I know that the above doesn't work but gives the sense of what I'd like to achieve.
Thanks for any pointers and best regards.
-aljo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不是
&lt; gateway&gt;
,而是这样:&lt; gateway&gt;
是基于某些服务接口的bean。您只需指向该Bean的
&lt; header&gt;
定义及其使用有效负载或消息的方法。文档中有一些解释: https://docs.spring.io/spring-integration/docs/current/referent/referent/html/message-transformation.html#header-enricher
Not
<gateway>
, but like this:The
<gateway>
is bean based on some service interface.You just point in the
<header>
definition to that bean and its method to be called against your payload or message.There is some explanation in the docs: https://docs.spring.io/spring-integration/docs/current/reference/html/message-transformation.html#header-enricher
看起来“附加网关定义”是进行此操作的方式。谢谢 @Artem-Bilan,指向我指向正确的方向。
我想直接从标头enricher打电话给我的链条通道。
如果我的链条通道是:
定义Java中的某个位置添加您的网关接口。
定义指向您的链条通道的网关:
然后,您可以从标头式Enricher中的Spel表达式在线拨打网关:
为我做的技巧。再次感谢。
It looks like the "additional gateway definition" is the way to go on this one. Thanks, @artem-bilan, for pointing me in the right direction.
I want to call to my chain-channel directly from a header-enricher.
If my chain-channel is:
Define somewhere in the Java add your gateway interface.
Define a gateway that points to your chain-channel:
Then you can call your gateway in-line from the SpEL expression in the header-enricher:
Does the trick for me. Thanks again.
@Artem-Bilan建议使用
&lt; enricher&gt;
而不是&lt; header-enricher&gt;
导致一个解决方案,该解决方案通过直接解决通道来避免Java界面签名。我们可以从
&lt; ronicher&gt;
调用此频道。在这里,为简单起见,&lt; ronicher&gt;
组件是链的一部分,但这不是要求:再次感谢指针。
@artem-bilan's suggestion to use
<enricher>
instead of<header-enricher>
leads to a solution that obviates the Java interface signatures by addressing directly a channel.We can call this channel from an
<enricher>
. Here, for simplicity, the<enricher>
component is part of a chain, but that is not a requirement:Thanks again for the pointers.