Spring 集成丢弃消息到 replyChannel
Spring Integration discard message to replyChannel
我有一个嵌套链。我想在内部链中添加一个过滤器,以便它可以在特定条件下继续流动或退出链。如果我不设置 discard-channel 或将 discard-channel 设置为 "nullChannel",它就会挂起。所以,我想到了路由到 Spring 在 headers 中设置的 replyChannel。使用以下配置,我得到 SpelEvaluationException。我如何将 discard-channel 设置为 replyChannel?请注意,由于我想多次调用 childChannel,因此 replyChannel 始终不相同。
<int:chain id="parentChain" input-channel="request">
....
<int:gateway request-channel="childChannel" />
<int:header-enricher .. </header-enricher>
<int:gateway request-channel="childChannel" />
....
</int:chain>
<int:chain input-channel="childChannel">
..
<int-xml:xpath-filter discard-channel="#{headers['replyChannel']}">
<int-xml:xpath-expression expression="" />
</int-xml:xpath-filter>
..
</int:chain>
不确定你的逻辑是否正确,但你确实不能这样丢弃。
你可以这样做:
<int-xml:xpath-filter discard-channel="discardChannel">
...
<int:header-value-router input-channel="discardChannel" header-name="replyChannel"/>
Filter
模式(及其组件)适用于那些不应发送到主要下游的消息。
我只是认为你应该使用不同的东西,而不是 <filter>
...
我有一个嵌套链。我想在内部链中添加一个过滤器,以便它可以在特定条件下继续流动或退出链。如果我不设置 discard-channel 或将 discard-channel 设置为 "nullChannel",它就会挂起。所以,我想到了路由到 Spring 在 headers 中设置的 replyChannel。使用以下配置,我得到 SpelEvaluationException。我如何将 discard-channel 设置为 replyChannel?请注意,由于我想多次调用 childChannel,因此 replyChannel 始终不相同。
<int:chain id="parentChain" input-channel="request">
....
<int:gateway request-channel="childChannel" />
<int:header-enricher .. </header-enricher>
<int:gateway request-channel="childChannel" />
....
</int:chain>
<int:chain input-channel="childChannel">
..
<int-xml:xpath-filter discard-channel="#{headers['replyChannel']}">
<int-xml:xpath-expression expression="" />
</int-xml:xpath-filter>
..
</int:chain>
不确定你的逻辑是否正确,但你确实不能这样丢弃。
你可以这样做:
<int-xml:xpath-filter discard-channel="discardChannel">
...
<int:header-value-router input-channel="discardChannel" header-name="replyChannel"/>
Filter
模式(及其组件)适用于那些不应发送到主要下游的消息。
我只是认为你应该使用不同的东西,而不是 <filter>
...