kos*_*ant 6 spring-integration spring-el
我需要使用键"foo_bar"记录消息头的值,以便当该头的值为"baz"时,日志消息看起来像这样:
标题foo_bar的值:baz
如何使用线控和记录通道适配器执行此操作?
kos*_*ant 13
使用logging-channel-adapter的expression属性并设置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"
/>
Run Code Online (Sandbox Code Playgroud)
使用expression属性时,根对象是spring集成消息.因此表达式中的"标题"可以获取消息的标题映射.
| 归档时间: |
|
| 查看次数: |
21209 次 |
| 最近记录: |