【发布时间】:2011-03-28 11:21:59
【问题描述】:
我需要使用键“foo_bar”记录消息头的值,以便当该头的值为“baz”时,日志消息看起来像这样:
标头 foo_bar 的值:baz
如何使用窃听器和记录通道适配器来做到这一点?
【问题讨论】:
标签: spring-integration spring-el
我需要使用键“foo_bar”记录消息头的值,以便当该头的值为“baz”时,日志消息看起来像这样:
标头 foo_bar 的值:baz
如何使用窃听器和记录通道适配器来做到这一点?
【问题讨论】:
标签: spring-integration spring-el
使用 logging-channel-adapter 的表达式属性,并像这样设置wire-tap 和 logging-channel-adapter:
<integration:channel id="channel1">
<integration:interceptors>
<integration:wire-tap channel="loggingChannel1"/>
</integration:interceptors>
</integration:channel>
<integration:logging-channel-adapter
id="loggingChannel1"
expression="'Value of header foo_bar: '.concat(headers.foo_bar)"
level="DEBUG"
/>
使用表达式属性时,根对象是spring集成消息。因此,表达式中的“headers”为您提供消息的 headers 映射。
【讨论】: