我想在不更改有效负载的情况下从 http 请求中检索请求上下文,所以我使用了丰富器,但似乎丰富器不能是 MuleMessage?我收到以下错误:
org.mule.model.resolvers.EntryPointNotFoundException: Failed to find entry point for component, the following resolvers tried but failed: [
CallableEntryPointResolver: Object "com.ict.cos.transformer.RequestContextBuilder@53dc8cb8" does not implement required interface "interface org.mule.api.lifecycle.Callable"
MethodHeaderPropertyEntryPointResolver: The required property "method" is not set on the event
ReflectionEntryPointResolver: Could not find entry point on: "com.ict.cos.transformer.RequestContextBuilder" with arguments: "{class org.apache.commons.httpclient.ContentLengthInputStream}"
AnnotatedEntryPointResolver: Component: com.ict.cos.transformer.RequestContextBuilder@53dc8cb8 doesn't have any annotated methods, skipping.
]
我的配置:
<enricher source="#[message]" target="#[flowVars['requestContext']]" doc:name="Message Enricher">
<component doc:name="Build request context">
<spring-object bean="requestContextBuilder"/>
</component>
</enricher>
requestContextBuilder:
public class RequestContextBuilder {
public RequestContext build(MuleMessage message) {
RequestContext requestContext = new RequestContext();
requestContext.setMethod(RESTMethod.get((String) message.getInboundProperty("http.method")));
requestContext.setAPI((String) message.getInboundProperty("http.request.path"));
requestContext.setQueryParams((String) message.getInboundProperty("http.query.string"));
return requestContext;
}
}