可以在mule应用程序中使用的文件连接器数量是否有限制。 我有2个骡子配置包括如下
<spring:beans>
<spring:import resource="classpath:ABC.xml" />
<spring:import resource="classpath:XYZ.xml" />
</spring:beans>
在ABC.xml中,我的文件连接器定义如下
<file:connector name="FileConnectorABC_1" autoDelete="false" streaming="false" workDirectory="${INBOUND_FAILURE_DIR}" workFileNamePattern="#[header:originalFilename]-#[function:dateStamp]-Processing" />
<file:connector name="FileConnectorABC_2" outputPattern="#[header:originalFilename]" />
<file:connector name="FileConnectorABC_3" autoDelete="false" streaming="false" workDirectory="${FAILURE_DIR}" workFileNamePattern="#[header:originalFilename]-#[function:dateStamp]-Processing" />
<file:connector name="FileConnectorABC_4" outputPattern="#[message.inboundProperties.originalFilename]" />
<file:connector name="FileConnectorABC_5" outputPattern="#[message.inboundProperties.originalFilename]" />
<file:connector name="FileConnectorABC_6" outputPattern="#[message.inboundProperties.originalFilename]" />
在XYZ.xml中,我的文件连接器定义如下
<file:connector name="FileConnectorXYZ_1" autoDelete="false" streaming="false" workDirectory="${INBOUND_FAILURE_DIR}" workFileNamePattern="#[header:originalFilename]-#[function:dateStamp]-Processing" />
<file:connector name="FileConnectorXYZ_2" outputPattern="#[message.inboundProperties.originalFilename]" />
<file:connector name="FileConnectorXYZ_3" outputPattern="#[message.inboundProperties.originalFilename]"/>
<file:connector name="FileConnectorXYZ_4" />
XYZ.xml中的连接器似乎不起作用。在骡子日志中,我看到了
[[my-app-1.0.0-SNAPSHOT] .FlowA.stage1.02] INFO org.mule.lifecycle.AbstractLifecycleManager - 初始化:'connector.VM.mule.default.dispatcher.1700044407'。 [[my-app-1.0.0-SNAPSHOT] .FlowA.stage1.02] INFO org.mule.lifecycle.AbstractLifecycleManager - 开始:'connector.VM.mule.default.dispatcher.1700044407'。 OBJ [[my-app-1.0.0-SNAPSHOT] .FlowA.stage1.02] INFO org.mule.lifecycle.AbstractLifecycleManager - 初始化:'connector.VM.mule.default.dispatcher.1885360656'。 [[my-app-1.0.0-SNAPSHOT] .FlowA.stage1.02] INFO org.mule.lifecycle.AbstractLifecycleManager - 开始:'connector.VM.mule.default.dispatcher.1885360656'。 OBJ [[my-app-1.0.0-SNAPSHOT] .FlowA.stage1.02] INFO org.mule.lifecycle.AbstractLifecycleManager - 初始化:'connector.VM.mule.default.dispatcher.1448628158'。 [[my-app-1.0.0-SNAPSHOT] .FlowA.stage1.02] INFO org.mule.lifecycle.AbstractLifecycleManager - 开始:'connector.VM.mule.default.dispatcher.1448628158'。 OBJ
但是文件不会分派到目标位置。
发送低于上一篇文章中使用的骡子配置
ParentFlow
<flow name="ParentFlow" doc:name="ParentFlow" tracking:enable-default-events="true">
<file:inbound-endpoint path="${SourceFilePath}"
connector-ref="ParentFlowInboundConnector"
responseTimeout="10000" tracking:enable-default-events="true">
<file:filename-regex-filter pattern="${REGEX}" caseSensitive="false"/>
</file:inbound-endpoint>
<object-to-string-transformer doc:name="Object to String"/>
<message-properties-transformer
doc:name="Message Properties">
<add-message-property key="Source_System" value="XXX" />
<add-message-property key="publisherName" value="YYY" />
<add-message-property key="FlowName" value="ZZZ"/>
</message-properties-transformer>
<!-- This would store the message in the db -->
<wire-tap>
<vm:outbound-endpoint path="PERSITENCE.OUT"/>
</wire-tap>
<request-reply>
<all doc:name="Move the message to all endpoints" enableCorrelation="ALWAYS">
<vm:outbound-endpoint path="PathA"/>
<vm:outbound-endpoint path="PathB"/>
<vm:outbound-endpoint path="PathC"/>
<vm:outbound-endpoint path="PathD"/>
</all>
<vm:inbound-endpoint path="Response">
<message-properties-transformer>
<add-message-property key="MULE_CORRELATION_GROUP_SIZE" value="4" />
</message-properties-transformer>
<collection-aggregator failOnTimeout="false" doc:name="Collection Aggregator" />
</vm:inbound-endpoint>
</request-reply>
<component class="ProcessorA" />
<component class="ProcessorB" />
<exception-strategy ref="Exception Strategy" doc:name="Reference Exception Strategy"/>
</flow>
子流
<flow name="PathA" doc:name="PathA">
<vm:inbound-endpoint path="PathA" >
<vm:transaction action="ALWAYS_BEGIN"/>
</vm:inbound-endpoint>
<message-properties-transformer doc:name="Message Properties">
<add-message-property key="originalFilename_processing" value="#[message.inboundProperties.originalFilename]" />
</message-properties-transformer>
<message-properties-transformer doc:name="Message Properties">
<add-message-property key="directory" value="#[message.inboundProperties.directory]" />
</message-properties-transformer>
<message-properties-transformer doc:name="Message Properties">
<add-message-property key="Destination_System" value="XXX" />
</message-properties-transformer>
<file:outbound-endpoint path="${OutPathA}" connector-ref="FileConnector_1"
tracking:enable-default-events="true"/>
<!--Send email alerts -->
<all doc:name="All" >
<processor-chain>
<message-property-filter pattern="turnOffEmail=false" caseSensitive="true" doc:name="Message Property"/>
<custom-transformer class="com.XXX.YYY.ZZZ.VelocityTemplateResolver" doc:name="Java">
<spring:property name="flowName" value="PPPP"/>
</custom-transformer>
<smtp:outbound-endpoint host="${SMTP_HOSTNAME}" port="${SMTP_PORT}" user="${SMTP_USERNAME}" password="${SMTP_PASSWORD}" to="${TO_ADDRESS}" from="${FROM_ADDRESS}" subject="${MAIL_SUBJECT}" cc="${MAIL_CC_ADDRESS}" bcc="${MAIL_BCC_ADDRESS}" responseTimeout="10000" transformer-refs="emailVelocityMessageTransformer" tracking:enable-default-events="true"/>
</processor-chain>
<processor-chain>
<message-property-filter pattern="turnOffEmail=false" caseSensitive="true" doc:name="Message Property"/>
<custom-transformer class="com.XXX.YYY.ZZZ.VelocityTemplateResolver" doc:name="Java">
<spring:property name="flowName" value="FlowName"/>
</custom-transformer>
<smtp:outbound-endpoint host="${SMTP_HOSTNAME}" port="${SMTP_PORT}" user="${SMTP_USERNAME}" password="${SMTP_PASSWORD}" to="${MAIL_TO_ADDRESS}" from="${MAIL_FROM_ADDRESS}" subject="${MAIL_SUBJECT}" cc="${MAIL_CC_ADDRESS}" bcc="${BCC_ADDRESS}" responseTimeout="10000" transformer-refs="emailVelocityMessageTransformer" tracking:enable-default-events="true"/>
</processor-chain>
</flow>