【问题标题】:relate a flow ref to java component mule将流引用与 java 组件 mule 相关联
【发布时间】:2016-05-20 11:32:30
【问题描述】:

我有一个主要流程,它从一个 http 端点开始,然后是一个实现接口的肥皂组件,然后是一个实现该接口的 java 组件 1。现在,我想添加一个流引用,然后添加一个实现相同接口的 java 组件 2。我得到“找不到入口点”的问题 我现在正在关注本教程 blogs.mulesoft.org/mule-school-invoking-component-methods-using-entry-point-resolvers/

下面是我的流程。

<flow name="CreateAccountFlow1" doc:name="CreateAccountFlow1"> 
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" 
            doc:name="HTTP" path="bank"/> 
    <cxf:jaxws-service doc:name="SOAP" serviceClass="com.essai2.AccountService"/> 
    <component class="com.essai2.AccountRequest" doc:name="Java"/> 
    <logger level="INFO" doc:name="Logger"/> 
    <flow-ref name="Projet2Flow1" doc:name="Flow Reference"/> 
    <component class="com.essai2.AccountResponse" doc:name="Java"/> 
    <logger level="INFO" doc:name="Logger"/> 
</flow>

谁能帮帮我?

【问题讨论】:

  • 添加您的 mule 配置和 Java 组件以获得更多帮助。
  • 这是我的 XML 配置流程
  • 从您的 flow-ref 返回的有效负载的类是什么。并确保在 flow-ref 之后的 Component 中有一个方法可以匹配有效负载的参数类型。
  • 请问我有一个问题 http 结果的类型是什么是 http 响应?如果是这样,我应该对对象转换器使用 httpresponse 以便将信息传递给我的 java 组件吗?

标签: mule mule-studio


【解决方案1】:
In mule there are many ways to invoke a Java component.

1. Entry point resolver 
2. Implemnt mule Life Cycle API i.e callable
3. Invoke component.

when ever Mule finds Java component as message processors in a flow, tries to execute above three methods .

In the java component if you have created any methods with param same as mule message payload , Entry Point resolver is used.

eg :  class XYZ{
      method1(String s1){

      }
      method2(List<String> S2){
      }
}

If Mule Message Payload has type String then method1 is invoked, if message payload has List of String , method2 is invoked during run time.

2. If you can invoke the Java component in the flow irrespective of type of the payload, should implement Callable interface which overrides onCall() method.

for eg : class XYS implements Callable{
  @override 
  onCall(MuleEventConext muleEventConext){

} 

using MuleEvent Conext you can extract the payload and process it.

3. Using Invoke component, you can create the object of the Class and invoke explicitly the method with appropriate Parameters passed.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-16
    • 1970-01-01
    • 1970-01-01
    • 2012-07-04
    • 1970-01-01
    • 2012-09-01
    • 1970-01-01
    • 2011-03-20
    相关资源
    最近更新 更多