• Subscription Options

  • What I write about

  • RSS Latest News From MuleSoft

  • Archives

  • Technical Features

  • Visitors Online

  • 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!

    Tags: ,

    3 Responses to “The Method Entry-point-resolver”

    1. A set of Mule Entry Point Resolvers | blog.ricston.com Says:

      [...] The Method Entr … 10/29 [...]

    2. Choosing the best Mule ESB Entry-Point Resolver | blog.ricston.com Says:

      [...] The Method Entr … 10/29 [...]

    3. Runtime Exceptions: NoSatisfiableMethodsException | blog.ricston.com Says:

      [...] The Method Entr … 10/29 [...]

    Leave a Reply

    Add video comment
    © Copyright 2005-2008 Ricston, All Rights Reserved
     Sitemap   Privacy Policy    Legal