Mule originalFilename is null

若如初见. 提交于 2019-12-11 02:29:14

问题


I am creating a process using Mule 3.4.1 which after processing a file it writes out the file with a specific filename. The input filename is: MMDDYYYY_sys_newhires.csv The processed filename is: MMDDYYYY_sys_newhires_NNN.csv

The code that i am using is below:

#[filename = message.inboundProperties.originalFilename;
  filename= com.cfa.apps.icims.mule.CounterSingleton.getInstance().getCount() 
         +  filename.substring(0,filename.length() -1 -4) + ".csv";
  filename]

The problem exists in the first line. message.inboundProperties.originalFilename.

I have tried a number of different combinations

message.inboundProperties.originalFilename
message.inboundProperties['originalFilename']
message.inboundProperties.originalFileName
message.inboundProperties['originalFileName']
message.inboundProperties.sourceFilename
message.inboundProperties['sourceFilename']
message.inboundProperties.sourceFileName
message.inboundProperties['sourceFileName']

Now I have also tried nesting the #[header:originalFilename], this works by itself, but you can't nest the expression within the code at least as far as I know.

Any help?

UPDATE: I am using the inbound file transport


回答1:


Since you don't show the endpoint configuration, I'm going to assume that this is happening with a file inbound endpoint.

For a reason that goes beyond imagination, the file message receiver behind the inbound endpoint puts the originalFilename property in the outbound scope when evaluating the expression to generate the archived file name.

So use: message.outboundProperties.originalFilename




回答2:


I have tested this mel EXPRESSION in ESB 3.7.1 and it is working fine!!

message.inboundProperties.originalFilename=='firstfile.txt'


来源:https://stackoverflow.com/questions/18881530/mule-originalfilename-is-null

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!