mule - Carry Original File Name to FTP endpoint -
using mule studio
version: 3.5.0 build id: 201402101410
i have simple flow. need pick file 1 ftp server , transfer ftp server. when file written target, filename looks kind of uuid rather original file name. how file name carry through? have tried #[header:originalfilename] throws error assume maybe file connectors. here flow:
<?xml version="1.0" encoding="utf-8"?> <mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:ftp="http://www.mulesoft.org/schema/mule/ftp" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" version="ce-3.4.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.mulesoft.org/schema/mule/ftp http://www.mulesoft.org/schema/mule/ftp/current/mule-ftp.xsd http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd"> <context:property-placeholder location="environment.properties"/> <flow name="sli-ftpflow1" doc:name="sli-ftpflow1"> <ftp:inbound-endpoint host="${local.ftp.host}" port="${local.ftp.port}" path="${local.ftp.path}" user="${local.ftp.user}" password="${local.ftp.pass}" responsetimeout="10000" doc:name="ftp" pollingfrequency="${local.ftp.pollingfreq}" binary="true" passive="false"/> <logger message="transferring file:" level="info" doc:name="logger"/> <ftp:outbound-endpoint host="${sli.ftp.host}" port="${sli.ftp.port}" path="${sli.ftp.path}" user="${sli.ftp.user}" password="${sli.ftp.pass}" responsetimeout="10000" doc:name="ftp" outputpattern="#[header:originalfilename]"/> </flow> </mule>
stack trace:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + started app 'sli-ftp' + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2014-03-19 22:10:38,058 [[sli-ftp].sli-ftpflow1.stage1.02] info org.mule.api.processor.loggermessageprocessor - transferring file: 2014-03-19 22:10:38,071 [[sli-ftp].connector.ftp.mule.default.dispatcher.01] info org.mule.lifecycle.abstractlifecyclemanager - initialising: 'connector.ftp.mule.default.dispatcher.1035665885'. object is: ftpmessagedispatcher 2014-03-19 22:10:38,071 [[sli-ftp].connector.ftp.mule.default.dispatcher.01] info org.mule.lifecycle.abstractlifecyclemanager - starting: 'connector.ftp.mule.default.dispatcher.1035665885'. object is: ftpmessagedispatcher 2014-03-19 22:10:38,078 [[sli-ftp].connector.ftp.mule.default.dispatcher.01] error org.mule.exception.defaultmessagingexceptionstrategy - ******************************************************************************** message : streaming failed. not output stream. failed route event via endpoint: defaultoutboundendpoint{endpointuri=ftp://esbuser%40newpig.com:<password>@webuatint/sli-mock, connector=ftpconnector { name=connector.ftp.mule.default lifecycle=start this=a40c648 numberofconcurrenttransactedreceivers=4 createmultipletransactedreceivers=true connected=true supportedprotocols=[ftp] serviceoverrides=<none> } , name='endpoint.ftp.webuatint.21.sli.mock', mep=one_way, properties={outputpattern=#[header:originalfilename]}, transactionconfig=transaction{factory=null, action=indifferent, timeout=0}, deleteunacceptedmessages=false, initialstate=started, responsetimeout=10000, endpointencoding=utf-8, disabletransporttransformer=false}. message payload of type: byte[] code : mule_error--2 -------------------------------------------------------------------------------- exception stack is: 1. expression evaluator "header" expression "outbound:originalfilename" returned null value required. (org.mule.api.expression.requiredvalueexception) org.mule.expression.expressionutils:239 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/requiredvalueexception.html) 2. streaming failed. not output stream. failed route event via endpoint: defaultoutboundendpoint{endpointuri=ftp://esbuser%40newpig.com:<password>@webuatint/sli-mock, connector=ftpconnector { name=connector.ftp.mule.default lifecycle=start this=a40c648 numberofconcurrenttransactedreceivers=4 createmultipletransactedreceivers=true connected=true supportedprotocols=[ftp] serviceoverrides=<none> } , name='endpoint.ftp.webuatint.21.sli.mock', mep=one_way, properties={outputpattern=#[header:originalfilename]}, transactionconfig=transaction{factory=null, action=indifferent, timeout=0}, deleteunacceptedmessages=false, initialstate=started, responsetimeout=10000, endpointencoding=utf-8, disabletransporttransformer=false}. message payload of type: byte[] (org.mule.api.transport.dispatchexception) org.mule.transport.ftp.ftpconnector:602 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/dispatchexception.html) -------------------------------------------------------------------------------- root exception stack trace: org.mule.api.expression.requiredvalueexception: expression evaluator "header" expression "outbound:originalfilename" returned null value required. @ org.mule.expression.expressionutils.getpropertyinternal(expressionutils.java:239) @ org.mule.expression.expressionutils.getpropertywithscope(expressionutils.java:67) @ org.mule.expression.expressionutils.getpropertywithscope(expressionutils.java:50) + 3 more (set debug level logging or '-dmule.verbose.exceptions=true' everything) ********************************************************************************
stack trace #[header:originalfilename] in logger:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + started app 'sli-ftp' + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2014-03-20 08:15:35,918 [[sli-ftp].sli-ftpflow1.stage1.02] error org.mule.exception.defaultmessagingexceptionstrategy - ******************************************************************************** message : expression evaluator "header" expression "outbound:originalfilename" returned null value required. (org.mule.api.expression.requiredvalueexception). message payload of type: byte[] code : mule_error--2 -------------------------------------------------------------------------------- exception stack is: 1. expression evaluator "header" expression "outbound:originalfilename" returned null value required. (org.mule.api.expression.requiredvalueexception) org.mule.expression.expressionutils:239 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/requiredvalueexception.html) 2. expression evaluator "header" expression "outbound:originalfilename" returned null value required. (org.mule.api.expression.requiredvalueexception). message payload of type: byte[] (org.mule.api.messagingexception) org.mule.execution.exceptiontomessagingexceptionexecutioninterceptor:35 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/messagingexception.html) -------------------------------------------------------------------------------- root exception stack trace: org.mule.api.expression.requiredvalueexception: expression evaluator "header" expression "outbound:originalfilename" returned null value required. @ org.mule.expression.expressionutils.getpropertyinternal(expressionutils.java:239) @ org.mule.expression.expressionutils.getpropertywithscope(expressionutils.java:67) @ org.mule.expression.expressionutils.getpropertywithscope(expressionutils.java:50) + 3 more (set debug level logging or '-dmule.verbose.exceptions=true' everything) ********************************************************************************
use mel: #[message.inboundproperties.originalfilename].
i think scope issue.
this changed in 3.4 -http://www.mulesoft.org/documentation/display/current/mule+esb+3.4.0+release+notes
mule 3.4+ originalfilename in inbound scope. use: #[message.inboundproperties.originalfilename]
mule < 3.4 originalfilename in outbound scope. use: #[message.outboundproperties.originalfilename]
issue documented here: https://www.mulesoft.org/jira/browse/mule-6743
Comments
Post a Comment