从线程中的任意位置访问Mule消息 [英] Access Mule Message from arbitrary place in a thread

查看:72
本文介绍了从线程中的任意位置访问Mule消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Mule ESB,可以从任意类中获取该线程的当前Mule消息句柄? 例如,如果我创建自定义log4j附加程序,它可以访问the子消息并从中提取数据吗?

With Mule ESB, from an arbitrary class, is it possible to get a handle of the current mule message for that thread? For example, if I create custom log4j appender, can it get access to the mule message and pull data from it?

推荐答案

是,通过使用RequestContext.getEvent().getMessage()(是的,它已弃用,并显示以下警告:

And yes, it is deprecated, with this warning:

如果需要访问MuleEvent或MuleMessage,则改为实现MessageProcessor或Callable

If access to MuleEvent or MuleMessage is required, then implement a MessageProcessor or Callable instead

但这并不总是可能的.因此,使用此静态帮助程序仍然是您的最佳选择.

But this is not always possible. So using this static helper remains your best option.

这篇关于从线程中的任意位置访问Mule消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆