Mule - entry point for component with multiple methods
I’ve just started learning Mule, the open-source ESB that is an implementation of the patterns in the book Enterprise Integration Patterns (ISBN: 978-0321200686).
As I started to look through the documentation and examples, I saw that the default way for the entry point into a component to be resolved is by matching the method parameters and return value to the expected types. This is fine when there’s only one matching method, but of course, an error is thrown when there is more than one matching method. None of the examples that I could find showed how to deal with this issue, other than to mention that a custom resolver could be implemented.
I think that this is unfortunate, since the idea being promoted is to use POJOs as the components, and it’s fairly likely that any real-world POJO being used as a component will have more than one matching method for any given method signature.
So, I poked around, and, as expected, there is indeed a simple answer, which is to use the method-entry-point-resolver and include-entry-point tags thusly:
:::xml
<component class="HelloImpl">
<method-entry-point-resolver>
<include-entry-point method="sayHello">
</method-entry-point-resolver>
</component>