如何从全局线路分接头获取频道信息 [英] How to get channel information from a global wire tap
问题描述
有没有办法使用全局线路分路
并且仍然能够记录有关相关频道的标识信息?为了澄清让我们假设,我想使用 global wire tap
如下:
Is there a way to use a global wire tap
and still be able to log the identification information about the associated channel? To clarify lets suppose, I want to use a global wire tap
as follows:
...
<int:channel id="myChannel1" />
...
<int:channel id="myChannel2" />
...
<int:wire-tap pattern="*" order="2" channel="wireTapChannel" />
<int:logging-channel-adapter
id="wireTapChannel"
expression="'payload: ' + getPayload()"
level="DEBUG"
logger-name="WIRETAP" />
这会记录类似的内容
14:44:31,350 DEBUG WIRETAP:126 - payload: some payload1
14:44:31,350 DEBUG WIRETAP:126 - payload: some payload2
现在有没有办法放置一个表达式,以便查看日志我也可以识别相关的频道?我期待这样的事情:
Now is there a way to put an expression so that looking into the logs I can identify the associated channels as well? I am expecting something like this:
14:44:31,350 DEBUG WIRETAP:126 - channel: myChannel1, payload: some payload1
14:44:31,350 DEBUG WIRETAP:126 - channel: myChannel2, payload: some payload2
不确定一旦流到达wireTapChannel,这个信息是否已经丢失
Not sure whether this information is already lost once the flow reaches the wireTapChannel
推荐答案
您可以启用 消息历史记录,然后使用 Spel 打印所需的标题.
You could enable Message History and then use a Spel to print the desired headers.
这篇关于如何从全局线路分接头获取频道信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!