我希望以下Mule( 2.1.2 )文件将“ / path / to / dir1 ”中的所有文件移动到“ / path / to / dir2 “,但它不起作用:
<mule
xmlns="http://www.mulesource.org/schema/mule/core/2.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:file="http://www.mulesource.org/schema/mule/file/2.1"
xsi:schemaLocation="
http://www.mulesource.org/schema/mule/core/2.1 http://www.mulesource.org/schema/mule/core/2.1/mule.xsd
http://www.mulesource.org/schema/mule/file/2.1 http://www.mulesource.org/schema/mule/file/2.1/mule-file.xsd">
<file:endpoint name="move"
path="/path/to/dir1"
moveToDirectory="/path/to/dir2"/>
<model>
<service name="service name: move file">
<inbound>
<inbound-endpoint ref="move"/>
</inbound>
</service>
</model>
</mule>
以下是./mule -config ../conf/test.xml
:
Mule home is at /home/wena/work/share/archives/mule-2.1.2
Running in console (foreground) mode by default, use Ctrl-C to exit...
Mule home is at /home/wena/work/share/archives/mule-2.1.2
Running Mule...
--> Wrapper Started as Console
Launching a JVM...
Starting the Mule Server...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
INFO 2011-02-18 12:59:31,853 [WrapperListener_start_runner] org.mule.MuleServer: Mule Server initializing...
INFO 2011-02-18 12:59:32,255 [WrapperListener_start_runner] org.mule.config.spring.MuleApplicationContext: Refreshing org.mule.config.spring.MuleApplicationContext@1e845c2: display name [org.mule.config.spring.MuleApplicationContext@1e845c2]; startup date [Fri Feb 18 12:59:32 SAST 2011]; root of context hierarchy
INFO 2011-02-18 12:59:33,221 [WrapperListener_start_runner] org.mule.config.spring.MuleApplicationContext: Bean factory for application context [org.mule.config.spring.MuleApplicationContext@1e845c2]: org.springframework.beans.factory.support.DefaultListableBeanFactory@bf5555
INFO 2011-02-18 12:59:33,599 [WrapperListener_start_runner] org.mule.transport.file.FileConnector: Initialising: FileConnector{this=b31b77, started=false, initialised=false, name='connector.file.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=false, supportedProtocols=[file], serviceOverrides=null}
INFO 2011-02-18 12:59:33,605 [WrapperListener_start_runner] org.mule.DefaultExceptionStrategy: Initialising exception listener: org.mule.DefaultExceptionStrategy@1b5391b
INFO 2011-02-18 12:59:33,614 [WrapperListener_start_runner] org.mule.component.simple.PassThroughComponent: Initialising: org.mule.component.simple.PassThroughComponent component for: service name: move file
INFO 2011-02-18 12:59:33,620 [WrapperListener_start_runner] org.mule.config.builders.AutoConfigurationBuilder: Configured Mule using "org.mule.config.spring.SpringXmlConfigurationBuilder" with configuration resource(s): "[ConfigResource{resourceName='../conf/test.xml'}]"
INFO 2011-02-18 12:59:33,620 [WrapperListener_start_runner] org.mule.config.builders.AutoConfigurationBuilder: Configured Mule using "org.mule.config.builders.AutoConfigurationBuilder" with configuration resource(s): "[ConfigResource{resourceName='../conf/test.xml'}]"
INFO 2011-02-18 12:59:33,620 [WrapperListener_start_runner] org.mule.MuleServer: Mule Server starting...
INFO 2011-02-18 12:59:33,634 [WrapperListener_start_runner] org.mule.transport.file.FileConnector: Starting: FileConnector{this=b31b77, started=false, initialised=true, name='connector.file.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=true, supportedProtocols=[file], serviceOverrides=null}
INFO 2011-02-18 12:59:33,640 [WrapperListener_start_runner] org.mule.transport.file.FileConnector: Started: FileConnector{this=b31b77, started=true, initialised=true, name='connector.file.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=true, supportedProtocols=[file], serviceOverrides=null}
INFO 2011-02-18 12:59:33,640 [WrapperListener_start_runner] org.mule.component.simple.PassThroughComponent: Starting: org.mule.component.simple.PassThroughComponent component for: service name: move file
INFO 2011-02-18 12:59:33,640 [WrapperListener_start_runner] org.mule.transport.file.FileConnector: Registering listener: service name: move file on endpointUri: file:///home/wena/temp/test1
INFO 2011-02-18 12:59:33,674 [WrapperListener_start_runner] org.mule.model.seda.SedaService: Service service name: move file has been started successfully
INFO 2011-02-18 12:59:33,674 [WrapperListener_start_runner] org.mule.util.queue.TransactionalQueueManager: Starting ResourceManager
INFO 2011-02-18 12:59:33,675 [WrapperListener_start_runner] org.mule.util.queue.TransactionalQueueManager: Started ResourceManager
INFO 2011-02-18 12:59:33,692 [WrapperListener_start_runner] org.mule.DefaultMuleContext:
**********************************************************************
* Mule ESB and Integration Platform *
* Version: 2.1.2 Build: 13558 *
* MuleSource, Inc. *
* For more information go to http://mule.mulesource.org *
* *
* Server started: 2011/02/18 12:59 PM *
* Server ID: 2a03e188-3b4e-11e0-8837-7d3fd629264e *
* JDK: 1.6.0_23 (mixed mode) *
* Encoding: OS: UTF-8, Mule: UTF-8 *
* OS: Linux (2.6.32-5-686-bigmem, i386) *
* Host: debian (127.0.1.1) *
* *
* Agents Running: None *
**********************************************************************
[ note ]我暂时无法升级到以后的Mule版本。
答案 0 :(得分:5)
将任何文件复制到/ path / to / dir1?
时,不会出现任何错误尝试此配置:
<model>
<service name="service name: move file">
<inbound>
<file:inbound-endpoint path="/path/to/dir1/"/>
</inbound>
<outbound>
<pass-through-router>
<file:outbound-endpoint path="/path/to/dir2/"
outputPattern="${ORIGINALNAME}"/>
</pass-through-router>
</outbound>
</service>
</model>
BTW:Mule 2.x仍然没问题,我也运行这个版本。
答案 1 :(得分:4)
文件不会随配置一起移动,因为入站文件端点生成的流有效负载永远不会被消耗掉。这是触发移动的有效负载消耗。
只需添加:
<log-component />
在您的入站路由器和文件开始移动之后。