0

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?

jonfornari
  • 530
  • 1
  • 4
  • 20

1 Answers1

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 InterceptingMessageProcessors): use an interceptor if you need to run before/after actions or if you want the possibility to stop processing.

David Dossot
  • 33,403
  • 4
  • 38
  • 72
  • Thank you very much. Im using the MessageProcessor solution. – jonfornari Nov 13 '12 at 16:54
  • There is any difference between implementing MessageProcessor interface or a pojo that implements callable (in terms of performance, tuning, behaviour etc..)? – jonfornari Apr 03 '13 at 19:37
  • 1
    There is a slight overhead in using a POJO called via ``, as it goes through the entry point resolver mechanism. If you invoke your POJO with ``, it will come very close to a custom message processor in term of overhead. But all in all, this overhead is typically orders of magnitude less than the time spent in IO, which is the bulk of an integration flow. – David Dossot Apr 03 '13 at 20:43