如何使用文件入站终结点来处理从MuleClient.dispatch()获得名称的文件作为有效负载 [英] How do I use a file inbound endpoint to process a file whose name I get from MuleClient.dispatch() as payload
问题描述
以下是我的文件入站端点配置.它正在处理指定路径上所有可用的.edi文件.
Below is my file inbound endpoint configuration. It is processing all .edi files available at the specified path.
<file:inbound-endpoint path="D:\test docs\in"
pollingFrequency="3000" responseTimeout="10000" doc:name="Incoming File">
<file:inbound-endpoint path="D:\test docs\in"
pollingFrequency="3000" responseTimeout="10000" doc:name="Incoming File">
<file:filename-regex-filter pattern="(.*).edi"
caseSensitive="false" />
<file:filename-regex-filter pattern="(.*).edi"
caseSensitive="false" />
我从spring应用程序向此端点发送一个事件,如下所示
I send an event to this endpoint from spring application as below
muleClient.dispatch("file://D:/test docs/in", inputFileName,
null);
muleClient.dispatch("file://D:/test docs/in", inputFileName,
null);
我将输入文件名作为message1.edi传递.我想将文件入站点限制为处理名称作为dispatch()中的有效载荷对象发送的单个文件.
I am passing the input file name as message1.edi. I want to restrict file inbound point to process single file whose name is sent as payload object in dispatch().
文件入站端点可能吗?
Muleclient.dispatch()是一个异步方法.我想暂停当前线程,直到我从dispatch()得到答复.截至目前,我正在使用thread.sleep().有没有更好的方法?
Muleclient.dispatch() is an async method. I want to pause the current thread till i get reply from dispatch(). As of now i am using thread.sleep(). Is there any better approach?
推荐答案
我可能会遗漏要点:-),但是我认为分派不是您要使用的. 要在m子文件侦听器上触发事件,请将您的message1.edi复制到文件夹文件://D:/test docs/in
I may be missing the point :-) however I don't think the dispatch is what you want to use. To trigger the event on the mule file listener, copy your message1.edi to the file folder file://D:/test docs/in
m子将拾取文件并处理.
mule will pickup the file and process.
或者,我不认为mule文件端点支持动态更改正则表达式,如果要动态更改文件,则可以使用muleClient.dispatch("file://D:/test docs/in"触发流程,inputFileName,null);并使用常规组件读取触发器中命名的文件
Alternativly, I don't think the mule file endpoint support dynamically changing the regex, if you want to dynamically change the file then trigger your flow with muleClient.dispatch("file://D:/test docs/in", inputFileName, null); and use a groovy component to read an process the file named in the trigger
def fileContent = new File("file://D:/test docs/in/" + inputFileName).text
return fileContent
根据非文本文件进行调整.
Adjust according if not text files.
这篇关于如何使用文件入站终结点来处理从MuleClient.dispatch()获得名称的文件作为有效负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!