将文件移动到多个位置的正确方法

时间:2015-03-27 21:34:47

标签: mule mule-studio

我继承了一些需要修改的旧骡子流,我想知道处理以前做过的正确方法。

电流:

<processor-chain doc:name="Processor Chain">
    <all doc:name="All">
        <file:outbound-endpoint
        path="archive"
        outputPattern="#[header:INBOUND:originalFilename]_#[function:datestamp:${standard.date.format}]_#[function:systime]"
        responseTimeout="${standard.response.timeout.millis}"
        doc:name="File Archive"/>
        <file:outbound-endpoint
        path="inbound"
        outputPattern="${brand.name}.refresh.#[function:datestamp:${standard.date.format}]_#[function:systime]"
        responseTimeout="${standard.response.timeout.millis}"
        encoding="UTF-8"
        doc:name="Inbound"/>
        <logger level="WARN" message="Downloaded file to inbound/${brand.name}.refresh" doc:name="Download File Logger"/>
    </all>
</processor-chain>

看到All被弃用了,他们说要使用Scatter Gather我试过这个:

<processor-chain doc:name="Processor Chain">
    <scatter-gather doc:name="Scatter-Gather">
        <file:outbound-endpoint
            path="archive"
            outputPattern="#[header:INBOUND:originalFilename]_#[function:datestamp:${standard.date.format}]_#[function:systime]"
            responseTimeout="${standard.response.timeout.millis}"
            doc:name="File Archive"/>
        <file:outbound-endpoint
            path="inbound"
            outputPattern="${brand.name}.refresh.#[function:datestamp:${standard.date.format}]_#[function:systime]"
            responseTimeout="${standard.response.timeout.millis}"
            encoding="UTF-8"
            doc:name="Inbound"/>
        <logger level="WARN" message="Downloaded file to inbound/${brand.name}.refresh" doc:name="Download File Logger"/>
    </scatter-gather>
</processor-chain>

但这给了我以下例外:

ERROR [esicustom].ClientFTPPull.stage1.02 org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message               : null (java.lang.UnsupportedOperationException). Message payload is of type: byte[]
Type                  : org.mule.api.MessagingException
Code                  : MULE_ERROR-29999
Payload               : [B@11164a7b
JavaDoc               : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html
********************************************************************************
Exception stack is:
1. null (java.lang.UnsupportedOperationException)
  org.mule.VoidMuleEvent:50 (null)
2. null (java.lang.UnsupportedOperationException). Message payload is of type: byte[] (org.mule.api.MessagingException)
  org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
********************************************************************************
Root Exception stack trace:
java.lang.UnsupportedOperationException
    at org.mule.VoidMuleEvent.getMessage(VoidMuleEvent.java:50)
    at org.mule.api.routing.AggregationContext$1.evaluate(AggregationContext.java:41)
    at org.apache.commons.collections.CollectionUtils.select(CollectionUtils.java:517)
    at org.apache.commons.collections.CollectionUtils.select(CollectionUtils.java:498)
    at org.mule.api.routing.AggregationContext.collectEventsWithExceptions(AggregationContext.java:84)
    at org.mule.routing.CollectAllAggregationStrategy.aggregate(CollectAllAggregationStrategy.java:32)
    at org.mule.routing.ScatterGatherRouter.processResponses(ScatterGatherRouter.java:197)
    at org.mule.routing.ScatterGatherRouter.process(ScatterGatherRouter.java:135)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.routing.AbstractSelectiveRouter.processEventWithProcessor(AbstractSelectiveRouter.java:308)
    at org.mule.routing.AbstractSelectiveRouter.routeWithProcessors(AbstractSelectiveRouter.java:298)
    at org.mule.routing.AbstractSelectiveRouter.process(AbstractSelectiveRouter.java:198)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:51)
    at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:118)
    at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:189)
    at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:182)
    at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:16)
    at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:30)
    at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14)
    at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:54)
    at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:44)
    at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50)
    at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:40)
    at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:41)
    at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:48)
    at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28)
    at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13)
    at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:109)
...
********************************************************************************

从FTP站点获取文件并将其转储到这样的两个位置的推荐方法是什么?

2 个答案:

答案 0 :(得分:2)

你刚遇到一个错误,请看看这个issue。它固定在3.6.0,当然还有3.6.1。 尝试在端点之后添加消息处理器作为解决方法,如JIRA票证中所述。

答案 1 :(得分:-1)

在你的scatter-gather定义中删除处理器链范围,并在itadd对象到字符串变换器之前。

相关问题