【问题标题】:Null exception thrown when running mule, when a devkit 3.0.0 method that takes a @InboundAttachments param运行 mule 时抛出空异常,当 devkit 3.0.0 方法采用 @InboundAttachments 参数时
【发布时间】:2013-07-31 00:14:25
【问题描述】:

我正在尝试使用@attachment http 属性

我在一个这样调用的流程中有一个名为 validate 的 devkit 方法

<http:connector name="httpConnector" doc:name="HTTP\HTTPS">
    <service-overrides
        messageFactory="org.mule.transport.http.HttpMultipartMuleMessageFactory" />
</http:connector>
<flow name="AttachmentTestFlow1" doc:name="AttachmentTestFlow1">        
    <http:inbound-endpoint connector-ref="httpConnector" doc:name="HTTP" exchange-pattern="request-response" host="localhost" port="8100"/>
    <Foo:validate config-ref="TestMessageSizeHappy"  />
</flow>

在 Devkit 中:

@Processor
public Object validate(@Payload InputStream in
    ,@InboundAttachments("*") Map<String, DataHandler> inboundAttachments
    ,@OutboundAttachments Map<String, DataHandler> outboundAttachments
    ) {

但是在运行我的 mule 应用程序时会抛出此错误:

错误 2013-07-30 09:06:39,225 [主要] org.mule.module.launcher.application.DefaultMuleApplication:空 org.xml.sax.SAXParseException: cvc-complex-type.2.4.b: 的内容 元素“xmlthreatprotection:validate”不完整。之一 '{"http://www.mulesoft.org/schema/mule/core":注解, "http://www.mulesoft.org/schema/mule/xmlthreatprotection":inbound-attachments}' 是期待。在 org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(未知 来源)

在我看来,mule 希望附件以某种方式作为属性放入! 当我删除 @attachment 的东西时,我在运行时不会出错。

【问题讨论】:

    标签: mule devkit


    【解决方案1】:

    您确定这受 DevKit 支持吗?我在执行@InboundAttachments@OutboundAttachments 注释的源代码中找不到单个集成测试,而@InboundHeaders@OutboundHeaders 都包含测试。

    您也可以接收MuleEvent 并通过它访问附件:

    @Processor
    @Inject
    public Object validate(@Payload InputStream in, MuleEvent muleEvent) {
    

    【讨论】:

    • 我已经在 3.0.0 中尝试过,但它会抛出异常,而 3.2。和 3.4 它甚至没有编译,我们发现你可以只使用非常具体的入站实现细节来获得多部分附件
    • 所以我不认为它受支持,它可能是我的 IDE 中的一个额外注释。我可能会玩你提到的@headers!
    • 您更喜欢@InboundHeaders 和OutboundHeaders 还是MuleEvent?
    • 您必须将 muleEvent-ref="foo" 添加到流程中以使 MuleEvent 工作并编译 devkit 3.4.0,这有点有趣跨度>
    • 您无需将muleEvent-ref 添加到您的流程中。 Mule 在没有它的情况下将 MuleEvent 传递给您的方法(如果您正确添加了 @Inject 注释)。
    猜你喜欢
    • 1970-01-01
    • 2020-09-30
    • 1970-01-01
    • 2016-06-15
    • 1970-01-01
    • 2012-08-21
    • 2015-06-03
    • 2012-08-10
    • 1970-01-01
    相关资源
    最近更新 更多