【发布时间】:2018-06-29 17:45:34
【问题描述】:
我在 Poll 中使用 Groovy 来检查给定位置的文件是否存在。 当有文件时,我的流程工作正常。但如果我删除该文件,流程不会触发。下面是我的代码
<flow name="monitor-dst-file-flow">
<poll doc:name="Poll">
<schedulers:cron-scheduler expression="0 0 23 ? * TUE-SAT"/>
<scripting:transformer doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[def endpointBuilder = muleContext.endpointFactory.getEndpointBuilder(
"sftp://${user}:${pwForGroovy}@${host}:${port}${inputpath}/?connector=SFTP")
endpointBuilder.addMessageProcessor(new org.mule.routing.MessageFilter(new org.mule.transport.file.filters.FilenameWildcardFilter('test.txt')))
def inboundEndpoint = endpointBuilder.buildInboundEndpoint() inboundEndpoint.request(30000L)]]>
</scripting:transformer>
</poll>
<choice doc:name="Choice">
<when expression="#[message.inboundProperties.originalFilename =="test.txt"]">
<logger level="INFO" doc:name="Logger" message="File Exists..."/>
</when>
<otherwise>
<logger message="FILE EXISTS" level="ERROR" doc:name="Logger"/>
<flow-ref name="email-notification-sub-flow" doc:name="Flow Reference"/>
</otherwise>
</choice>
</flow>
这里,如果没有test.txt文件,我无法调试Choice组件。
上面写着 -Polling of monitor-dst-file-flow returned null, the flow will not be invoked.
我无法确定运行流程的确切解决方案。如果给定文件不存在,我必须处理这种情况。
【问题讨论】:
标签: mule mule-component mule-el mule-esb