1

我的流程中定义了以下组件:

  <component doc:name="GraduationService">
      <method-entry-point-resolver>
          <include-entry-point method="getGraduationDatesWithPidmOrStudentId"/>
      </method-entry-point-resolver>
      <spring-object bean="graduationService" />
  </component>

我正在尝试调用“graduationService”bean 中定义的“getGraduationDatesWithPidmOrStudentId”方法。这是方法签名的样子:

public Object getGraduationDatesWithPidmOrStudentId(@Payload Payload payload,
    @InboundHeaders("studentId") String studentId, 
    @InboundHeaders("pidm") String pidm ) {  ....... }

我收到以下错误:

Message               : Failed to find entry point for component, the following resolvers tried but failed: [
ExplicitMethodEntryPointResolver: Could not find entry point on: "edu.ucdavis.iet.apis.students.graduation.service.GraduationService" with arguments: "{class java.lang.String}"
]
Code                  : MULE_ERROR-321
--------------------------------------------------------------------------------
Exception stack is:
1. Failed to find entry point for component, the following resolvers tried but failed: [
ExplicitMethodEntryPointResolver: Could not find entry point on: "edu.ucdavis.iet.apis.students.graduation.service.GraduationService" with arguments: "{class java.lang.String}"
] (org.mule.model.resolvers.EntryPointNotFoundException)
  org.mule.model.resolvers.DefaultEntryPointResolverSet:49 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/model/resolvers/EntryPointNotFoundException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.model.resolvers.EntryPointNotFoundException: Failed to find entry point for component, the following resolvers tried but failed: [
ExplicitMethodEntryPointResolver: Could not find entry point on: "edu.ucdavis.iet.apis.students.graduation.service.GraduationService" with arguments: "{class java.lang.String}"
]
    at org.mule.model.resolvers.DefaultEntryPointResolverSet.invoke(DefaultEntryPointResolverSet.java:49)
    at org.mule.component.DefaultComponentLifecycleAdapter.invoke(DefaultComponentLifecycleAdapter.java:339)
    at org.mule.component.AbstractJavaComponent.invokeComponentInstance(AbstractJavaComponent.java:82)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

如果我删除 InboundHeaders 的注释并将“@Payload Payload 有效负载”更改为“@Payload String 有效负载”,我至少无法解决该方法。那么,我似乎不明白 @InboundHeader 注释应该如何工作。

4

1 回答 1

0

使用注释时,您不需要专门设置入口点解析器,因为它将在后台使用 AnnotatedEntryPointResolver。

所以以下将起作用:

public Object getGraduationDatesWithPidmOrStudentId(@Payload String payload,
    @InboundHeaders("studentId") String studentId, 
    @InboundHeaders("pidm") String pidm ) {  ....... }

和:

<component doc:name="GraduationService">
     <spring-object bean="graduationService" />
</component>

您也可以使用以下方法专门设置它:

<component>
   <custom-entry-point-resolver class="org.mule.impl.model.resolvers.AnnotatedEntryPointResolver" />
   <spring-object bean="graduationService" />
</component>

另请注意,您不需要将有效负载设置为有效负载的实例。Mule 将尝试转换有效负载以匹配参数类型。

于 2014-06-26T09:47:01.380 回答