The Method Entry-point-resolver
My last entry point resolver (EPR) related post talked about the property-entry-point-resolver which is a great way to specify the name of the method that should be invoked inside a service. There is another way to do this, of course.
Instead of using that EPR, you can take advantage of the method-entry-point-resolver and configure things in the Mule config file:
<model name="methodEPR"> <method-entry-point-resolver> <include-entry-point method="queryName"/> </method-entry-point-resolver> <service name="methodService"> <inbound> <inbound-endpoint ref="forMethodEPR"/> </inbound> <component class="com.ricston.tests.StringService"/> </service> </model>
I’ve configured the model to use this EPR and have set things up so that the entry-point to look for is a method called queryName. Eagle-eyed fans of the blog will have noted that I’m using the same component I did last time.
The test case for this is similar to the one used for the property-entry-point-resolver:
public void testMethodEPR () { MuleMessage aReply = null; try { MuleClient myClient = new MuleClient (); aReply = myClient.send ("forMethodEPR", new DefaultMuleMessage ("Hello"),10000); } catch (MuleException e) { fail (e.getDetailedMessage()); } assertNotNull (aReply); assertNotNull (aReply.getPayload()); assertTrue (aReply.getPayload() instanceof String); assertEquals ((String) aReply.getPayload(), "Antoine Borg"); }
The main difference between this EPR and the property EPR is that this makes most sense if you know which method to use at design-time. If you don’t, but will have that information at run-time, then the property EPR is what you should use.

If you enjoyed this post, make sure you subscribe to my RSS feed!
November 19th, 2009 at 9:35 PM
[...] The Method Entr … 10/29 [...]
November 19th, 2009 at 11:00 PM
[...] The Method Entr … 10/29 [...]
November 26th, 2009 at 11:10 AM
[...] The Method Entr … 10/29 [...]