Mule - 文件和 https 端点冲突

Mule - File and https endpoint conflict

我在 mule 中遇到以下问题。这是我的流程定义:

<flow name="httpsTestConnection" processingStrategy="synchronous">
    <servlet:inbound-endpoint path="/httpsTestConnection" responseTimeout="10000" />
    <file:outbound-endpoint path="${hip.home.dir}/online/Requests" responseTimeout="10000"/>
    <https:outbound-endpoint exchange-pattern="request-response" address="${test.connection.service.url}" http:contentType="text/xml" http:method="POST" connector-ref="httpsClientConnector"/>
    <object-to-string-transformer />
    <file:outbound-endpoint path="${hip.home.dir}/online/Responses" responseTimeout="10000"/>
</flow>

我在某个 url 上阅读了一条请求,我想将该消息记录到文件系统上的 Requests 文件夹中。 我使用 2-WAY SSL 将消息发送到 HTTPS 端点。 之后我得到响应并将其记录到文件系统上的 Responses 文件夹中。

如果我删除以下行,一切正常:

<file:outbound-endpoint path="${hip.home.dir}/online/Requests" responseTimeout="10000"/>

然后负载仅用于发送到 https 出站端点。

指定文件出站端点组件时,会记录请求文件,但在日志中遇到以下异常:

Caused by: java.lang.IllegalStateException: Content must be set before entity is written
at org.apache.commons.httpclient.methods.InputStreamRequestEntity.writeRequest(InputStreamRequestEntity.java:177)
at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)

有没有办法让这成为可能?要一起使用 file:outbound-端点和 https:outbound-端点吗?

我认为问题出在 file:outbound-endpoint 消耗了 servlet:inbound-endpoint 产生的输入,从而阻止了 https:outbound-endpoint 读取流。

添加:

<object-to-string-transformer />

servlet:inbound-endpoint 之后将输入流反序列化为字符串,以便 filehttp 出站端点都可以使用消息负载。