问题
Im trying to implement a simple message observer on Mule that don't need to mutate the message.
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.
So, the best way to do this now is implementing the MessageProcessor interface and simply return the MuleEvent param in the process method?
回答1:
If you need to access the whole MuleEvent
, either a MessageProcessor
or a POJO that implements Callable
.
Otherwise, if you only need to observe the payload a simple POJO component would do the trick.
Note that Mule also offers interceptors (and InterceptingMessageProcessor
s): use an interceptor if you need to run before/after actions or if you want the possibility to stop processing.
来源:https://stackoverflow.com/questions/13361727/how-to-implement-a-mule-message-observer