【问题标题】:Mule: Two file outbound endpoint and one inbound endpoint to the same location issueMule:两个文件出站端点和一个入站端点到同一位置问题
【发布时间】:2016-03-19 19:25:33
【问题描述】:
<flow name="flow1"..>
  ..
  <file:outbound-endpoint path="${workdir}/folder/inbox"/>
  ..
  ..
</flow>

<flow name="flow2"..>
  ..
  <file:outbound-endpoint path="${workdir}/folder/inbox"/>
  ..
  ..
</flow>

<flow name="flow3"..>
  <file:inbound-endpoint connector-ref="someConnector"
        path="${workdir}/folder/inbox"
        moveToDirectory="${global.workdir}/123"
        transformer-refs="Transformer"
        moveToPattern="#[header:originalFilename]-#[function:datestamp-yyyy-MM-dd_HH-mm-ss.SSS]" />
  ..
  ..
</flow>    

================================================ ==

我的前两个流具有相同的文件出站端点路径,而我的第三个流的入站端点路径指向相同的文件夹位置。我得到了错误:

Message               : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=file://C:/temp/mule/data/vendors/inbound/856, connector=FileConnector
{
  name=inboundFileConnector
  lifecycle=start
  this=c4092f
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[file]
  serviceOverrides=<none>
}
,  name='endpoint.C.mule.data.vendors.inbound.856', mep=ONE_WAY, properties={}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: ReceiverFileInputStream
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Stream Closed (java.io.IOException)
  java.io.FileInputStream:-2 (null)
2. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=file://C:/mule/data/vendors/856, connector=FileConnector
{
  name=inboundFileConnector
  lifecycle=start
  this=c4092f
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[file]
  serviceOverrides=<none>
}
,  name='endpoint.C..mule.data.vendors.in.856', mep=ONE_WAY, properties={}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: ReceiverFileInputStream (org.mule.api.transport.DispatchException)
  org.mule.transport.AbstractMessageDispatcher:109 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.io.IOException: Stream Closed
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(Unknown Source)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1025)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

================================================ ==

我可以在一个流中有两个出站端点,其路径与另一个流路径的入站端点相同吗?

<flow name="flow1"..>
  ..
  <file:outbound-endpoint path="${workdir}/folder/inbox"/>
  ..
  ..
  <file:outbound-endpoint path="${workdir}/folder/inbox"/>
  ..
</flow>

.. ..

【问题讨论】:

    标签: file path streaming mule endpoints


    【解决方案1】:
    <object-to-byte-array-transformer/>     
    

    // 需要将输入流转换为字节数组以避免被窃听器关闭

    添加上述object-to-byte-array-transformer有助于转换输入流。

    【讨论】:

    • 客人主你是我的救主:D
    【解决方案2】:

    尝试在文件连接器中禁用流式传输:

    <file:connector name="sampleFileConnector"  streaming="false" ></file:connector> 
    

    然后在您的所有文件端点中引用此连接器。

    <file:outbound-endpoint connector-ref="sampleFileConnector" path="${workdir}/folder/inbox"/>
    

    【讨论】:

      猜你喜欢
      • 2014-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-16
      • 1970-01-01
      • 2014-04-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多