如何实现Mule Message Observer? [英] How to implement a Mule Message Observer?

查看:85
本文介绍了如何实现Mule Message Observer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Mule上实现一个简单的消息观察程序,而该消息观察程序不需要更改消息。

Im trying to implement a simple message observer on Mule that don't need to mutate the message.

链接说,最简单的方法是扩展AbstractMessageObserver。但是正如我在此链接该类已在较早版本的Mule中删除。

This link on the documentation says that the easiest way is to extend the AbstractMessageObserver. But as i can see on this link the class has been removed in the earlier versions of Mule.

那么,现在做到这一点的最好方法是实现MessageProcessor接口,并简单地在处理方法中返回MuleEvent参数?

So, the best way to do this now is implementing the MessageProcessor interface and simply return the MuleEvent param in the process method?

推荐答案

如果您需要访问整个 MuleEvent ,则可以使用 MessageProcessor 或实现 Callable 。

If you need to access the whole MuleEvent, either a MessageProcessor or a POJO that implements Callable.

否则,如果您只需要观察有效载荷,那么一个简单的POJO组件就可以解决问题。

Otherwise, if you only need to observe the payload a simple POJO component would do the trick.

请注意,Mule还提供了拦截器(和 InterceptingMessageProcessor s):如果需要在操作之前/之后运行,或者需要,请使用拦截器停止处理的可能性。

Note that Mule also offers interceptors (and InterceptingMessageProcessors): use an interceptor if you need to run before/after actions or if you want the possibility to stop processing.

这篇关于如何实现Mule Message Observer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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