|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Mule 2 and FileConnectorHi,
I now migrate my Mule 1.4 application to mule 2 and have a minor problem with the new file connector. When I receive a file I need the java.io.File object. In version 1.4 I've the following configuration: <connector name="myFileConnector" className="org.mule.providers.file.FileConnector"> <properties> <property name="pollingFrequency" value="1000" /> <property name="binaryMode" value="false" /> <property name="moveToDirectory" value="./test-data/out" /> <map name="serviceOverrides"> <property name="inbound.transformer" value="org.mule.transformers.NoActionTransformer"/> <property name="message.adapter" value="org.mule.providers.file.FileMessageAdapter"/> </map> </properties> </connector> by setting NoActionTransformer and FileMessageAdapter my component receives a File object. Now migrating to Mule 2 I read the documentation (http://mulesource.org/display/MULE2USER/File+Transport), founding the comments on autoDelete: By default, when a file is received it is read into a String or byte[]. The file is moved if the moveToDirectory is set, otherwise it is deleted. To access the File object set this property to false and specify a NoActionTransformer transformer for the connector. Mule will not delete the file, so it's up to the component to delete it when it's done. If the moveToDirectory is set, the file is first moved, then the File object of the moved file is passed to the component. It is recommended that a moveToDirectory is specified when turning autoDelete off. <file:connector name="piFileConnector" autoDelete="false" streaming="false" pollingFrequency="1000" moveToDirectory="./test-data/out"> <service-overrides inboundTransformer="org.mule.transformers.NoActionTransformer"/> </file:connector> Using this connector my service component receives a byte[]. The standard message adapter from the file connector uses org.mule.transport.file.FileContentsMessageAdapter, which is responsible to generete the byte[]. Now I override the message adapter: <service-overrides inboundTransformer="org.mule.transformers.NoActionTransformer" messageAdapter="org.mule.transport.file.FileMessageAdapter"/> When I start up the ESB server and I copy a test file into the listed path it seems that Mule reads the file and run into a never ending loop, because the file can't be moved into the outbout directory: 10:42:31,084 [myFileConnector.receiver.7] ERROR AbstractExceptionListener : ******************************************************************************** Message : Failed to move file "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in\Test.txt" to "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out\Test.txt". The file might already exist. Type : org.mule.api.DefaultMuleException Code : MULE_ERROR-11004 JavaDoc : http://mule.mulesource.org/docs/apidocs/org/mule/api/DefaultMuleException.html ******************************************************************************** Exception stack is: 1. Failed to move file "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in\Test.txt" to "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out\Test.txt". The file might already exist. (org.mule.api.DefaultMuleException) org.mule.transport.file.FileMessageReceiver:264 (http://mule.mulesource.org/docs/apidocs/org/mule/api/DefaultMuleException.html) ******************************************************************************** Root Exception stack trace: org.mule.api.DefaultMuleException: Failed to move file "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in\Test.txt" to "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out\Test.txt". The file might already exist. at org.mule.transport.file.FileMessageReceiver.moveAndDelete(FileMessageReceiver.java:264) at org.mule.transport.file.FileMessageReceiver.processFile(FileMessageReceiver.java:233) at org.mule.transport.file.FileMessageReceiver.poll(FileMessageReceiver.java:143) at org.mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java:47) at org.mule.work.WorkerContext.run(WorkerContext.java:310) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575) at java.lang.Thread.run(Unknown Source) ******************************************************************************** 10:42:32,067 [myFileConnector.receiver.8] ERROR AbstractExceptionListener : ******************************************************************************** Message : Failed to move file "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in\Test.txt" to "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out\Test.txt". The file might already exist. Type : org.mule.api.DefaultMuleException Code : MULE_ERROR-11004 JavaDoc : http://mule.mulesource.org/docs/apidocs/org/mule/api/DefaultMuleException.html ******************************************************************************** Exception stack is: 1. Failed to move file "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in\Test.txt" to "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out\Test.txt". The file might already exist. (org.mule.api.DefaultMuleException) org.mule.transport.file.FileMessageReceiver:264 (http://mule.mulesource.org/docs/apidocs/org/mule/api/DefaultMuleException.html) ******************************************************************************** Root Exception stack trace: org.mule.api.DefaultMuleException: Failed to move file "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in\Test.txt" to "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out\Test.txt". The file might already exist. at org.mule.transport.file.FileMessageReceiver.moveAndDelete(FileMessageReceiver.java:264) at org.mule.transport.file.FileMessageReceiver.processFile(FileMessageReceiver.java:233) at org.mule.transport.file.FileMessageReceiver.poll(FileMessageReceiver.java:143) at org.mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java:47) at org.mule.work.WorkerContext.run(WorkerContext.java:310) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575) at java.lang.Thread.run(Unknown Source) ******************************************************************************** I also tried to define a output pattern and delete the output directory. The file should also read once!! Any hints? regards markus |
|
|
Re: Mule 2 and FileConnectorHi,
A couple of comments: The documentation of the MULE2USER site is still in the process of being updated, lots of things are the same in 2.0 but quite a few things have changed and may or not have been updated yet. The default behaviour for the file connector has changed in 2.0 - Streaming is now used by default. This means that a FileInputStream is passed as the payload and is only closed when a transformer or component reads the FileInputStream. The move/copy operations are performed when the stream is closed. - Streaming can be turned off by using streaming="false". If streaming is disabled then the FileContentsMessageAdaptor is used and the file is read/moved/copied after being read into the FileContentsMessageAdaptor by the receiver. It looks like you want the File object (a pointer to the file) rather than either of the above options. You might consider using streaming but I understand that sometimes a File object is needed if you are using a 3rd party service component, an API that has already bee defined or are migrating as in your case. I'll take a look into this scenarios and add tests to the file connecter test cases for this. This may well be a bug, if so I'l create an issue for it and it should make it into 2.0.1. Dan On 8 Apr 2008, at 05:47, mdemo wrote: > > Hi, > > I now migrate my Mule 1.4 application to mule 2 and have a minor > problem > with the new file connector. When I receive a file I need the > java.io.File > object. > > In version 1.4 I've the following configuration: > <connector name="myFileConnector" > className="org.mule.providers.file.FileConnector"> > <properties> > <property name="pollingFrequency" value="1000" /> > <property name="binaryMode" value="false" /> > <property name="moveToDirectory" value="./test-data/out" /> > <map name="serviceOverrides"> > <property name="inbound.transformer" > value="org.mule.transformers.NoActionTransformer"/> > <property name="message.adapter" > value="org.mule.providers.file.FileMessageAdapter"/> > </map> > </properties> > </connector> > > by setting NoActionTransformer and FileMessageAdapter my component > receives > a File object. Now migrating to Mule 2 I read the documentation > (http://mulesource.org/display/MULE2USER/File+Transport), founding the > comments on autoDelete: > > By default, when a file is received it is read into a String or > byte[]. The > file is moved if the moveToDirectory is set, otherwise it is > deleted. To > access the File object set this property to false and specify a > NoActionTransformer transformer for the connector. Mule will not > delete the > file, so it's up to the component to delete it when it's done. If the > moveToDirectory is set, the file is first moved, then the File > object of the > moved file is passed to the component. It is recommended that a > moveToDirectory is specified when turning autoDelete off. > > > <file:connector name="piFileConnector" autoDelete="false" > streaming="false" > pollingFrequency="1000" moveToDirectory="./test-data/out"> > <service-overrides > inboundTransformer="org.mule.transformers.NoActionTransformer"/> > </file:connector> > > Using this connector my service component receives a byte[]. The > standard > message adapter from the file connector uses > org.mule.transport.file.FileContentsMessageAdapter, which is > responsible to > generete the byte[]. Now I override the message adapter: > > <service-overrides > inboundTransformer="org.mule.transformers.NoActionTransformer" > messageAdapter="org.mule.transport.file.FileMessageAdapter"/> > > When I start up the ESB server and I copy a test file into the > listed path > it seems that Mule reads the file and run into a never ending loop, > because > the file can't be moved into the outbout directory: > > 10:42:31,084 [myFileConnector.receiver.7] ERROR > AbstractExceptionListener : > ******************************************************************************** > Message : Failed to move file > "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in > \Test.txt" to > "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out > \Test.txt". > The file might already exist. > Type : org.mule.api.DefaultMuleException > Code : MULE_ERROR-11004 > JavaDoc : > http://mule.mulesource.org/docs/apidocs/org/mule/api/DefaultMuleException.html > ******************************************************************************** > Exception stack is: > 1. Failed to move file "C:\Development\workspace\spikes\mule > 2.0-spike\test-data\in\Test.txt" to "C:\Development\workspace\spikes > \mule > 2.0-spike\test-data\out\Test.txt". The file might already exist. > (org.mule.api.DefaultMuleException) > org.mule.transport.file.FileMessageReceiver:264 > (http://mule.mulesource.org/docs/apidocs/org/mule/api/DefaultMuleException.html > ) > ******************************************************************************** > Root Exception stack trace: > org.mule.api.DefaultMuleException: Failed to move file > "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in > \Test.txt" to > "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out > \Test.txt". > The file might already exist. > at > org > .mule > .transport > .file.FileMessageReceiver.moveAndDelete(FileMessageReceiver.java:264) > at > org > .mule > .transport > .file.FileMessageReceiver.processFile(FileMessageReceiver.java:233) > at > org > .mule > .transport.file.FileMessageReceiver.poll(FileMessageReceiver.java:143) > at > org > .mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java: > 47) > at org.mule.work.WorkerContext.run(WorkerContext.java:310) > at > edu > .emory > .mathcs > .backport > .java > .util > .concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) > at > edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor > $Worker.run(ThreadPoolExecutor.java:575) > at java.lang.Thread.run(Unknown Source) > > ******************************************************************************** > > 10:42:32,067 [myFileConnector.receiver.8] ERROR > AbstractExceptionListener : > ******************************************************************************** > Message : Failed to move file > "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in > \Test.txt" to > "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out > \Test.txt". > The file might already exist. > Type : org.mule.api.DefaultMuleException > Code : MULE_ERROR-11004 > JavaDoc : > http://mule.mulesource.org/docs/apidocs/org/mule/api/DefaultMuleException.html > ******************************************************************************** > Exception stack is: > 1. Failed to move file "C:\Development\workspace\spikes\mule > 2.0-spike\test-data\in\Test.txt" to "C:\Development\workspace\spikes > \mule > 2.0-spike\test-data\out\Test.txt". The file might already exist. > (org.mule.api.DefaultMuleException) > org.mule.transport.file.FileMessageReceiver:264 > (http://mule.mulesource.org/docs/apidocs/org/mule/api/DefaultMuleException.html > ) > ******************************************************************************** > Root Exception stack trace: > org.mule.api.DefaultMuleException: Failed to move file > "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in > \Test.txt" to > "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out > \Test.txt". > The file might already exist. > at > org > .mule > .transport > .file.FileMessageReceiver.moveAndDelete(FileMessageReceiver.java:264) > at > org > .mule > .transport > .file.FileMessageReceiver.processFile(FileMessageReceiver.java:233) > at > org > .mule > .transport.file.FileMessageReceiver.poll(FileMessageReceiver.java:143) > at > org > .mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java: > 47) > at org.mule.work.WorkerContext.run(WorkerContext.java:310) > at > edu > .emory > .mathcs > .backport > .java > .util > .concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) > at > edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor > $Worker.run(ThreadPoolExecutor.java:575) > at java.lang.Thread.run(Unknown Source) > > ******************************************************************************** > > I also tried to define a output pattern and delete the output > directory. The > file should also read once!! > > Any hints? > regards markus > > > > -- > View this message in context: http://www.nabble.com/Mule-2-and-FileConnector-tp16549768p16549768.html > Sent from the Mule - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Mule 2 and FileConnectorHi,
I created an issue for this: http://mule.mulesource.org/jira/browse/MULE-3198 Dan On 8 Apr 2008, at 10:58, Daniel Feist wrote: > Hi, > > A couple of comments: > > The documentation of the MULE2USER site is still in the process of > being updated, lots of things are the same in 2.0 but quite a few > things have changed and may or not have been updated yet. > > The default behaviour for the file connector has changed in 2.0 > > - Streaming is now used by default. This means that a > FileInputStream is passed as the payload and is only closed when a > transformer or component reads the FileInputStream. The move/copy > operations are performed when the stream is closed. > - Streaming can be turned off by using streaming="false". If > streaming is disabled then the FileContentsMessageAdaptor is used > and the file is read/moved/copied after being read into the > FileContentsMessageAdaptor by the receiver. > > It looks like you want the File object (a pointer to the file) > rather than either of the above options. You might consider using > streaming but I understand that sometimes a File object is needed if > you are using a 3rd party service component, an API that has already > bee defined or are migrating as in your case. > > I'll take a look into this scenarios and add tests to the file > connecter test cases for this. This may well be a bug, if so I'l > create an issue for it and it should make it into 2.0.1. > > Dan > > On 8 Apr 2008, at 05:47, mdemo wrote: > >> >> Hi, >> >> I now migrate my Mule 1.4 application to mule 2 and have a minor >> problem >> with the new file connector. When I receive a file I need the >> java.io.File >> object. >> >> In version 1.4 I've the following configuration: >> <connector name="myFileConnector" >> className="org.mule.providers.file.FileConnector"> >> <properties> >> <property name="pollingFrequency" value="1000" /> >> <property name="binaryMode" value="false" /> >> <property name="moveToDirectory" value="./test-data/out" /> >> <map name="serviceOverrides"> >> <property name="inbound.transformer" >> value="org.mule.transformers.NoActionTransformer"/> >> <property name="message.adapter" >> value="org.mule.providers.file.FileMessageAdapter"/> >> </map> >> </properties> >> </connector> >> >> by setting NoActionTransformer and FileMessageAdapter my component >> receives >> a File object. Now migrating to Mule 2 I read the documentation >> (http://mulesource.org/display/MULE2USER/File+Transport), founding >> the >> comments on autoDelete: >> >> By default, when a file is received it is read into a String or >> byte[]. The >> file is moved if the moveToDirectory is set, otherwise it is >> deleted. To >> access the File object set this property to false and specify a >> NoActionTransformer transformer for the connector. Mule will not >> delete the >> file, so it's up to the component to delete it when it's done. If the >> moveToDirectory is set, the file is first moved, then the File >> object of the >> moved file is passed to the component. It is recommended that a >> moveToDirectory is specified when turning autoDelete off. >> >> >> <file:connector name="piFileConnector" autoDelete="false" >> streaming="false" >> pollingFrequency="1000" moveToDirectory="./test-data/out"> >> <service-overrides >> inboundTransformer="org.mule.transformers.NoActionTransformer"/> >> </file:connector> >> >> Using this connector my service component receives a byte[]. The >> standard >> message adapter from the file connector uses >> org.mule.transport.file.FileContentsMessageAdapter, which is >> responsible to >> generete the byte[]. Now I override the message adapter: >> >> <service-overrides >> inboundTransformer="org.mule.transformers.NoActionTransformer" >> messageAdapter="org.mule.transport.file.FileMessageAdapter"/> >> >> When I start up the ESB server and I copy a test file into the >> listed path >> it seems that Mule reads the file and run into a never ending loop, >> because >> the file can't be moved into the outbout directory: >> >> 10:42:31,084 [myFileConnector.receiver.7] ERROR >> AbstractExceptionListener : >> ******************************************************************************** >> Message : Failed to move file >> "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in >> \Test.txt" to >> "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out >> \Test.txt". >> The file might already exist. >> Type : org.mule.api.DefaultMuleException >> Code : MULE_ERROR-11004 >> JavaDoc : >> http://mule.mulesource.org/docs/apidocs/org/mule/api/DefaultMuleException.html >> ******************************************************************************** >> Exception stack is: >> 1. Failed to move file "C:\Development\workspace\spikes\mule >> 2.0-spike\test-data\in\Test.txt" to "C:\Development\workspace\spikes >> \mule >> 2.0-spike\test-data\out\Test.txt". The file might already exist. >> (org.mule.api.DefaultMuleException) >> org.mule.transport.file.FileMessageReceiver:264 >> (http://mule.mulesource.org/docs/apidocs/org/mule/api/DefaultMuleException.html >> ) >> ******************************************************************************** >> Root Exception stack trace: >> org.mule.api.DefaultMuleException: Failed to move file >> "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in >> \Test.txt" to >> "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out >> \Test.txt". >> The file might already exist. >> at >> org >> .mule >> .transport >> .file.FileMessageReceiver.moveAndDelete(FileMessageReceiver.java:264) >> at >> org >> .mule >> .transport >> .file.FileMessageReceiver.processFile(FileMessageReceiver.java:233) >> at >> org >> .mule >> .transport.file.FileMessageReceiver.poll(FileMessageReceiver.java: >> 143) >> at >> org >> .mule >> .transport.PollingReceiverWorker.run(PollingReceiverWorker.java:47) >> at org.mule.work.WorkerContext.run(WorkerContext.java:310) >> at >> edu >> .emory >> .mathcs >> .backport >> .java >> .util >> .concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java: >> 1061) >> at >> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor >> $Worker.run(ThreadPoolExecutor.java:575) >> at java.lang.Thread.run(Unknown Source) >> >> ******************************************************************************** >> >> 10:42:32,067 [myFileConnector.receiver.8] ERROR >> AbstractExceptionListener : >> ******************************************************************************** >> Message : Failed to move file >> "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in >> \Test.txt" to >> "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out >> \Test.txt". >> The file might already exist. >> Type : org.mule.api.DefaultMuleException >> Code : MULE_ERROR-11004 >> JavaDoc : >> http://mule.mulesource.org/docs/apidocs/org/mule/api/DefaultMuleException.html >> ******************************************************************************** >> Exception stack is: >> 1. Failed to move file "C:\Development\workspace\spikes\mule >> 2.0-spike\test-data\in\Test.txt" to "C:\Development\workspace\spikes >> \mule >> 2.0-spike\test-data\out\Test.txt". The file might already exist. >> (org.mule.api.DefaultMuleException) >> org.mule.transport.file.FileMessageReceiver:264 >> (http://mule.mulesource.org/docs/apidocs/org/mule/api/DefaultMuleException.html >> ) >> ******************************************************************************** >> Root Exception stack trace: >> org.mule.api.DefaultMuleException: Failed to move file >> "C:\Development\workspace\spikes\mule 2.0-spike\test-data\in >> \Test.txt" to >> "C:\Development\workspace\spikes\mule 2.0-spike\test-data\out >> \Test.txt". >> The file might already exist. >> at >> org >> .mule >> .transport >> .file.FileMessageReceiver.moveAndDelete(FileMessageReceiver.java:264) >> at >> org >> .mule >> .transport >> .file.FileMessageReceiver.processFile(FileMessageReceiver.java:233) >> at >> org >> .mule >> .transport.file.FileMessageReceiver.poll(FileMessageReceiver.java: >> 143) >> at >> org >> .mule >> .transport.PollingReceiverWorker.run(PollingReceiverWorker.java:47) >> at org.mule.work.WorkerContext.run(WorkerContext.java:310) >> at >> edu >> .emory >> .mathcs >> .backport >> .java >> .util >> .concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java: >> 1061) >> at >> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor >> $Worker.run(ThreadPoolExecutor.java:575) >> at java.lang.Thread.run(Unknown Source) >> >> ******************************************************************************** >> >> I also tried to define a output pattern and delete the output >> directory. The >> file should also read once!! >> >> Any hints? >> regards markus >> >> >> >> -- >> View this message in context: http://www.nabble.com/Mule-2-and-FileConnector-tp16549768p16549768.html >> Sent from the Mule - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |