Mule学习笔记(二)

简介: Mule的第一个应用非常简单。却也可以看出Mule的运行机制。上例中,实现的是Hello world 的例子,过程为:用户输入内容,回车,然后显示Hello,[输入的内容]。这个实现非常简单,但是,却也存在一些问题,mule是怎么知道显示这些内容的,现在就研究这个。 也许大家觉得,在XXXX.xml中已经配置了类路径,mule当然可以找到这个类,问题就在这里,mule找到了实现类,那

Mule的第一个应用非常简单。却也可以看出Mule的运行机制。上例中,实现的是Hello world 的例子,过程为:用户输入内容,回车,然后显示Hello,[输入的内容]。这个实现非常简单,但是,却也存在一些问题,mule是怎么知道显示这些内容的,现在就研究这个。

也许大家觉得,在XXXX.xml中已经配置了类路径,mule当然可以找到这个类,问题就在这里,mule找到了实现类,那他是如何找到对应的方法的呢?OK,做一下尝试

1、尝试一

将inteface修改为:

  1. package demo.mule.umo; 
  2.  
  3. public interface HelloWorld { 
  4.     public String sayHello(String str); 
  5.     public String sayHello(); 
package demo.mule.umo; public interface HelloWorld { public String sayHello(String str); public String sayHello(); }

实现类修改为:

  1. package demo.mule.umo.impl; 
  2. import demo.mule.umo.HelloWorld; 
  3. public class HelloWorldImpl implements HelloWorld { 
  4.     @Override 
  5.     public String sayHello(String str) { 
  6.         return "Hello," + str; 
  7.     } 
  8.     @Override 
  9.     public String sayHello() { 
  10.         return "Hello world"
  11.     } 
package demo.mule.umo.impl; import demo.mule.umo.HelloWorld; public class HelloWorldImpl implements HelloWorld { @Override public String sayHello(String str) { return "Hello," + str; } @Override public String sayHello() { return "Hello world"; } }

运行项目:运行成功!

2、尝试二

修改interface为:

  1. package demo.mule.umo; 
  2.  
  3. public interface HelloWorld { 
  4.     public String sayHello(String str); 
  5.     public String sayHello2(String str); 
package demo.mule.umo; public interface HelloWorld { public String sayHello(String str); public String sayHello2(String str); }

修改实现类为:

  1. package demo.mule.umo.impl; 
  2. import demo.mule.umo.HelloWorld; 
  3. public class HelloWorldImpl implements HelloWorld { 
  4.     @Override 
  5.     public String sayHello(String str) { 
  6.         return "Hello," + str; 
  7.     } 
  8.     @Override 
  9.     public String sayHello2(String str) { 
  10.         return "Hello2 ," + str; 
  11.     } 
package demo.mule.umo.impl; import demo.mule.umo.HelloWorld; public class HelloWorldImpl implements HelloWorld { @Override public String sayHello(String str) { return "Hello," + str; } @Override public String sayHello2(String str) { return "Hello2 ," + str; } }

运行:抛出ERROR

  1. ERROR 2011-02-09 17:04:41,874 [HelloUMO.2] org.mule.service.DefaultServiceExceptionStrategy:  
  2. ******************************************************************************** 
  3. Message               : [ 
  4. The required property "method" is not set on the event 
  5. CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable" 
  6. Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" 
  7. Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" 
  8. Type                  : org.mule.model.resolvers.EntryPointNotFoundException 
  9. Code                  : MULE_ERROR--2 
  10. JavaDoc               : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html 
  11. ******************************************************************************** 
  12. Exception stack is: 
  13. 1. [ 
  14. The required property "method" is not set on the event 
  15. CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable" 
  16. Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" 
  17. Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" 
  18. ] (org.mule.model.resolvers.EntryPointNotFoundException) 
  19.   org.mule.model.resolvers.DefaultEntryPointResolverSet:63 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html) 
  20. ******************************************************************************** 
  21. Root Exception stack trace: 
  22. org.mule.model.resolvers.EntryPointNotFoundException: [ 
  23. The required property "method" is not set on the event 
  24. CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable" 
  25. Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" 
  26. Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" 
  27.     at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:63
  28.     at org.mule.component.DefaultLifecycleAdapter.invoke(DefaultLifecycleAdapter.java:205
  29.     at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:83
  30.     at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:74
  31.     at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:133
  32.     at org.mule.component.AbstractComponent.invoke(AbstractComponent.java:161
  33.     at org.mule.service.AbstractService.invokeComponent(AbstractService.java:929
  34.     at org.mule.model.seda.SedaService.access$100(SedaService.java:56
  35.     at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:574
  36.     at org.mule.work.WorkerContext.run(WorkerContext.java:310
  37.     at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061
  38.     at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575
  39.     at java.lang.Thread.run(Thread.java:619
  40. ******************************************************************************** 
ERROR 2011-02-09 17:04:41,874 [HelloUMO.2] org.mule.service.DefaultServiceExceptionStrategy: ******************************************************************************** Message : [ The required property "method" is not set on the event CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable" Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" ] Type : org.mule.model.resolvers.EntryPointNotFoundException Code : MULE_ERROR--2 JavaDoc : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html ******************************************************************************** Exception stack is: 1. [ The required property "method" is not set on the event CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable" Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" ] (org.mule.model.resolvers.EntryPointNotFoundException) org.mule.model.resolvers.DefaultEntryPointResolverSet:63 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html) ******************************************************************************** Root Exception stack trace: org.mule.model.resolvers.EntryPointNotFoundException: [ The required property "method" is not set on the event CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@12f1bf0" does not implement required interface "interface org.mule.api.lifecycle.Callable" Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" Found too many possible methods on object "demo.mule.umo.impl.HelloWorldImpl" that accept parameters "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" ] at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:63) at org.mule.component.DefaultLifecycleAdapter.invoke(DefaultLifecycleAdapter.java:205) at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:83) at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:74) at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:133) at org.mule.component.AbstractComponent.invoke(AbstractComponent.java:161) at org.mule.service.AbstractService.invokeComponent(AbstractService.java:929) at org.mule.model.seda.SedaService.access$100(SedaService.java:56) at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:574) at org.mule.work.WorkerContext.run(WorkerContext.java:310) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575) at java.lang.Thread.run(Thread.java:619) ********************************************************************************

3、尝试三

修改interface:

  1. package demo.mule.umo; 
  2.  
  3. public interface HelloWorld { 
  4.     public String sayHello(); 
  5.     public String sayHello2(); 
package demo.mule.umo; public interface HelloWorld { public String sayHello(); public String sayHello2(); }

修改实现类:

  1. package demo.mule.umo.impl; 
  2. import demo.mule.umo.HelloWorld; 
  3. public class HelloWorldImpl implements HelloWorld { 
  4.     @Override 
  5.     public String sayHello() { 
  6.         return "Hello world"
  7.     } 
  8.     @Override 
  9.     public String sayHello2() { 
  10.         return "Hello2 world"
  11.     } 
package demo.mule.umo.impl; import demo.mule.umo.HelloWorld; public class HelloWorldImpl implements HelloWorld { @Override public String sayHello() { return "Hello world"; } @Override public String sayHello2() { return "Hello2 world"; } }

运行:抛出ERROR

  1. ERROR 2011-02-09 17:07:27,811 [HelloUMO.2] org.mule.service.DefaultServiceExceptionStrategy:  
  2. ******************************************************************************** 
  3. Message               : [ 
  4. The required property "method" is not set on the event 
  5. CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable" 
  6. Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" 
  7. Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" 
  8. Type                  : org.mule.model.resolvers.EntryPointNotFoundException 
  9. Code                  : MULE_ERROR--2 
  10. JavaDoc               : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html 
  11. ******************************************************************************** 
  12. Exception stack is: 
  13. 1. [ 
  14. The required property "method" is not set on the event 
  15. CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable" 
  16. Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" 
  17. Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" 
  18. ] (org.mule.model.resolvers.EntryPointNotFoundException) 
  19.   org.mule.model.resolvers.DefaultEntryPointResolverSet:63 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html) 
  20. ******************************************************************************** 
  21. Root Exception stack trace: 
  22. org.mule.model.resolvers.EntryPointNotFoundException: [ 
  23. The required property "method" is not set on the event 
  24. CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable" 
  25. Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" 
  26. Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" 
  27.     at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:63
  28.     at org.mule.component.DefaultLifecycleAdapter.invoke(DefaultLifecycleAdapter.java:205
  29.     at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:83
  30.     at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:74
  31.     at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:133
  32.     at org.mule.component.AbstractComponent.invoke(AbstractComponent.java:161
  33.     at org.mule.service.AbstractService.invokeComponent(AbstractService.java:929
  34.     at org.mule.model.seda.SedaService.access$100(SedaService.java:56
  35.     at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:574
  36.     at org.mule.work.WorkerContext.run(WorkerContext.java:310
  37.     at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061
  38.     at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575
  39.     at java.lang.Thread.run(Thread.java:619
  40. ******************************************************************************** 
ERROR 2011-02-09 17:07:27,811 [HelloUMO.2] org.mule.service.DefaultServiceExceptionStrategy: ******************************************************************************** Message : [ The required property "method" is not set on the event CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable" Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" ] Type : org.mule.model.resolvers.EntryPointNotFoundException Code : MULE_ERROR--2 JavaDoc : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html ******************************************************************************** Exception stack is: 1. [ The required property "method" is not set on the event CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable" Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" ] (org.mule.model.resolvers.EntryPointNotFoundException) org.mule.model.resolvers.DefaultEntryPointResolverSet:63 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html) ******************************************************************************** Root Exception stack trace: org.mule.model.resolvers.EntryPointNotFoundException: [ The required property "method" is not set on the event CallableEntryPointResolver:Object "demo.mule.umo.impl.HelloWorldImpl@1f02b85" does not implement required interface "interface org.mule.api.lifecycle.Callable" Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}" Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=false, acceptVoidMethods=false}" ] at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:63) at org.mule.component.DefaultLifecycleAdapter.invoke(DefaultLifecycleAdapter.java:205) at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:83) at org.mule.component.AbstractJavaComponent.doInvoke(AbstractJavaComponent.java:74) at org.mule.component.AbstractComponent.invokeInternal(AbstractComponent.java:133) at org.mule.component.AbstractComponent.invoke(AbstractComponent.java:161) at org.mule.service.AbstractService.invokeComponent(AbstractService.java:929) at org.mule.model.seda.SedaService.access$100(SedaService.java:56) at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:574) at org.mule.work.WorkerContext.run(WorkerContext.java:310) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575) at java.lang.Thread.run(Thread.java:619) ********************************************************************************

结论:

比较两次抛出的ERROR,不难发现这句话“

Could not find entry point on: "demo.mule.umo.impl.HelloWorldImpl" with arguments: "{class java.lang.String}" using resolver "ReflectionEntryPointResolver{ignoredMethods=[getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll]{transformFirst=true, acceptVoidMethods=false}"

”,真相大白:mule通过<inbound></inbound>中得到的结果,作为寻找方法中参数的依据,由于该项目中,从终端输入的内容,项目接收时为String类型,因此,mule将查找参数类型为String的方法,同时,mule将抛弃所有符合“getClass, clone, equals, hashCode, getInvocationHandler, get*, wait, is*, notify, toString, notifyAll”的方法,如果符合条件的只有一个,那正好调用,否则,就抛出ERROR。

如果程序中很可以确定是哪个方法,大可让他自己去找,成人之美,若是不能确定是哪个方法,那么就只能够指腹为婚了,进行如下配置:

将尝试二的配置文件修改为:

  1. <?xml version="1.0" encoding="UTF-8"?> 
  2. <mule xmlns="http://www.mulesource.org/schema/mule/core/2.2" 
  3.        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  4.        xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2" 
  5.     xsi:schemaLocation=" 
  6.        http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd 
  7.        http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd"> 
  8.     <stdio:connector name="SystemStreamConnector"     
  9.         promptMessage="Please enter yout name: " messageDelayTime="1000"/>  
  10.          
  11.     <model name="HelloSample">       
  12.         <service name="HelloUMO">     
  13.             <inbound>     
  14.                 <stdio:inbound-endpoint system="IN" />    
  15.             </inbound>                
  16.             <component class="demo.mule.umo.impl.HelloWorldImpl"
  17.                 <method-entry-point-resolver> 
  18.                     <include-entry-point method="sayHello2"/> 
  19.                 </method-entry-point-resolver> 
  20.             </component>     
  21.      
  22.             <outbound>     
  23.                 <pass-through-router>     
  24.                     <stdio:outbound-endpoint system="OUT" />     
  25.                 </pass-through-router>     
  26.             </outbound>     
  27.         </service>           
  28.     </model> 
  29.      
  30. </mule> 
<?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesource.org/schema/mule/core/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2" xsi:schemaLocation=" http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd"> <stdio:connector name="SystemStreamConnector" promptMessage="Please enter yout name: " messageDelayTime="1000"/> <model name="HelloSample"> <service name="HelloUMO"> <inbound> <stdio:inbound-endpoint system="IN" /> </inbound> <component class="demo.mule.umo.impl.HelloWorldImpl"> <method-entry-point-resolver> <include-entry-point method="sayHello2"/> </method-entry-point-resolver> </component> <outbound> <pass-through-router> <stdio:outbound-endpoint system="OUT" /> </pass-through-router> </outbound> </service> </model> </mule>

设置方法切入点,运行,成功!

目录
相关文章
|
Java
ES6 学习笔记一
ES6 学习笔记一
64 0
|
8月前
|
Java
es 学习笔记
es 学习笔记
45 1
|
8月前
|
JavaScript
使用TS的一些基础知识
使用TS的一些基础知识
94 0
|
8月前
|
JavaScript 前端开发 编译器
ts面试题总结
ts面试题总结
132 0
|
SQL 分布式计算 Shell
DolphinScheduler教程(01)- 入门(下)
DolphinScheduler教程(01)- 入门(下)
586 0
|
分布式计算 应用服务中间件 持续交付
DolphinScheduler教程(01)- 入门(上)
DolphinScheduler教程(01)- 入门(上)
989 0
|
JavaScript 前端开发 开发者
ts知识点
ts知识点
61 0
|
JavaScript
ES6 学习笔记二
ES6 学习笔记二
47 0
|
JavaScript 前端开发 IDE
TS知识点
TS知识点
|
JSON API 数据格式
ES7学习笔记(三)新建索引
与ES的交互方式 与es的交互方式采用http的请求方式,请求的格式如下: curl -X '://:/?' -d '' 是请求的方法,比如:GET、POST、DELETE、PUT等。
2978 0
ES7学习笔记(三)新建索引