You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by youhaodeyi <yo...@gmail.com> on 2009/10/22 10:00:18 UTC

Re: How can I know whether a file is received completely or not for a ftp poller?

I don't want to read xml file. I set a marshaler for binary file. This is my
xbean.xml for the ftp poller:

<ftp:poller service="request" endpoint="endpoint"
		targetService="request-receiver" uri="ftp://anonymous@localhost:21"
		deleteFile="true">
		<property name="marshaler">
			<bean class="org.apache.servicemix.components.util.BinaryFileMarshaler"
/>
		</property>

	</ftp:poller>

A ftp client will upload any files to the ftp server and I want to let the
request-receiver to be notified when the file is uploaded completely. 


Gert Vanthienen wrote:
> 
> L.S.,
> 
> By default, if you read an incomplete XML file and try to process it,
> processing will fail and the ERROR MessageExchange will result in the
> file remaining on the server and being tried again a few seconds
> later.  Usually, there's not much you need to do there.
> 
> If you want to avoid the overhead over the ERROR exchanges for
> incomplete files, you can always configure a file filter on the ftp
> poller endpoint (e.g. so you only pick up .xml files) and then upload
> the files to the ftp server with another filename (e.g. .tmp as the
> extension) and rename the file when the upload is complete.  Some FTP
> server daemons (like ProFTPd) will even allow you to do configure that
> at the FTP server side, so the FTP client does not have to deal with
> it.
> 
> If you want to send the file to the FTP server from within ServiceMix,
> we also have this feature available in our own ftp sender endpoint: if
> you specify an uploadSuffix, that will be used while uploading and the
> rename will happen once the file has been uploaded completely.
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/10/22 youhaodeyi <yo...@gmail.com>:
>>
>> I set up a ftp poller and whenever a file is uploading to the server, the
>> poller will send message to a "receiver" SU even if the file has not been
>> uploaded completely. What I want to do is to get the message in
>> "receiver"
>> when the file is uploaded to the server, not uploading. How can I do
>> this?
>> --
>> View this message in context:
>> http://www.nabble.com/How-can-I-know-whether-a-file-is-received-completely-or-not-for-a-ftp-poller--tp26004849p26004849.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: http://www.nabble.com/How-can-I-know-whether-a-file-is-received-completely-or-not-for-a-ftp-poller--tp26004849p26005619.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: How can I know whether a file is received completely or not for a ftp poller?

Posted by youhaodeyi <yo...@gmail.com>.
Hi,

I use servicemix 3.3. Does this version support this new feature? Could you
tell me how to use this feature? I didn't see this in the user guide.

thanks


Gert Vanthienen wrote:
> 
> L.S.,
> 
> If there's a way to figure out by the data you read if the file is
> complete, you can always build your own marshaler that extends the
> BinaryFileMarshaler to figure that out before actually sending the
> exchange.  If you download a new snapshot of ServiceMix, there's a new
> feature in the FTP poller that checks if the file is still growing in
> size to check if it's still being uploaded.
> 
> The only other solution I see would be by using the upload-then-rename
> strategy I mention in my previous post.
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/10/22 youhaodeyi <yo...@gmail.com>:
>>
>> I don't want to read xml file. I set a marshaler for binary file. This is
>> my
>> xbean.xml for the ftp poller:
>>
>> <ftp:poller service="request" endpoint="endpoint"
>>                targetService="request-receiver"
>> uri="ftp://anonymous@localhost:21"
>>                deleteFile="true">
>>                <property name="marshaler">
>>                        <bean
>> class="org.apache.servicemix.components.util.BinaryFileMarshaler"
>> />
>>                </property>
>>
>>        </ftp:poller>
>>
>> A ftp client will upload any files to the ftp server and I want to let
>> the
>> request-receiver to be notified when the file is uploaded completely.
>>
>>
>> Gert Vanthienen wrote:
>>>
>>> L.S.,
>>>
>>> By default, if you read an incomplete XML file and try to process it,
>>> processing will fail and the ERROR MessageExchange will result in the
>>> file remaining on the server and being tried again a few seconds
>>> later.  Usually, there's not much you need to do there.
>>>
>>> If you want to avoid the overhead over the ERROR exchanges for
>>> incomplete files, you can always configure a file filter on the ftp
>>> poller endpoint (e.g. so you only pick up .xml files) and then upload
>>> the files to the ftp server with another filename (e.g. .tmp as the
>>> extension) and rename the file when the upload is complete.  Some FTP
>>> server daemons (like ProFTPd) will even allow you to do configure that
>>> at the FTP server side, so the FTP client does not have to deal with
>>> it.
>>>
>>> If you want to send the file to the FTP server from within ServiceMix,
>>> we also have this feature available in our own ftp sender endpoint: if
>>> you specify an uploadSuffix, that will be used while uploading and the
>>> rename will happen once the file has been uploaded completely.
>>>
>>> Regards,
>>>
>>> Gert Vanthienen
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>> Blog: http://gertvanthienen.blogspot.com/
>>>
>>>
>>>
>>> 2009/10/22 youhaodeyi <yo...@gmail.com>:
>>>>
>>>> I set up a ftp poller and whenever a file is uploading to the server,
>>>> the
>>>> poller will send message to a "receiver" SU even if the file has not
>>>> been
>>>> uploaded completely. What I want to do is to get the message in
>>>> "receiver"
>>>> when the file is uploaded to the server, not uploading. How can I do
>>>> this?
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/How-can-I-know-whether-a-file-is-received-completely-or-not-for-a-ftp-poller--tp26004849p26004849.html
>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>> -----
>>> ---
>>> Gert Vanthienen
>>> http://gertvanthienen.blogspot.com
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-can-I-know-whether-a-file-is-received-completely-or-not-for-a-ftp-poller--tp26004849p26005619.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: http://www.nabble.com/How-can-I-know-whether-a-file-is-received-completely-or-not-for-a-ftp-poller--tp26004849p26006154.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: How can I know whether a file is received completely or not for a ftp poller?

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,

If there's a way to figure out by the data you read if the file is
complete, you can always build your own marshaler that extends the
BinaryFileMarshaler to figure that out before actually sending the
exchange.  If you download a new snapshot of ServiceMix, there's a new
feature in the FTP poller that checks if the file is still growing in
size to check if it's still being uploaded.

The only other solution I see would be by using the upload-then-rename
strategy I mention in my previous post.

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/10/22 youhaodeyi <yo...@gmail.com>:
>
> I don't want to read xml file. I set a marshaler for binary file. This is my
> xbean.xml for the ftp poller:
>
> <ftp:poller service="request" endpoint="endpoint"
>                targetService="request-receiver" uri="ftp://anonymous@localhost:21"
>                deleteFile="true">
>                <property name="marshaler">
>                        <bean class="org.apache.servicemix.components.util.BinaryFileMarshaler"
> />
>                </property>
>
>        </ftp:poller>
>
> A ftp client will upload any files to the ftp server and I want to let the
> request-receiver to be notified when the file is uploaded completely.
>
>
> Gert Vanthienen wrote:
>>
>> L.S.,
>>
>> By default, if you read an incomplete XML file and try to process it,
>> processing will fail and the ERROR MessageExchange will result in the
>> file remaining on the server and being tried again a few seconds
>> later.  Usually, there's not much you need to do there.
>>
>> If you want to avoid the overhead over the ERROR exchanges for
>> incomplete files, you can always configure a file filter on the ftp
>> poller endpoint (e.g. so you only pick up .xml files) and then upload
>> the files to the ftp server with another filename (e.g. .tmp as the
>> extension) and rename the file when the upload is complete.  Some FTP
>> server daemons (like ProFTPd) will even allow you to do configure that
>> at the FTP server side, so the FTP client does not have to deal with
>> it.
>>
>> If you want to send the file to the FTP server from within ServiceMix,
>> we also have this feature available in our own ftp sender endpoint: if
>> you specify an uploadSuffix, that will be used while uploading and the
>> rename will happen once the file has been uploaded completely.
>>
>> Regards,
>>
>> Gert Vanthienen
>> ------------------------
>> Open Source SOA: http://fusesource.com
>> Blog: http://gertvanthienen.blogspot.com/
>>
>>
>>
>> 2009/10/22 youhaodeyi <yo...@gmail.com>:
>>>
>>> I set up a ftp poller and whenever a file is uploading to the server, the
>>> poller will send message to a "receiver" SU even if the file has not been
>>> uploaded completely. What I want to do is to get the message in
>>> "receiver"
>>> when the file is uploaded to the server, not uploading. How can I do
>>> this?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-can-I-know-whether-a-file-is-received-completely-or-not-for-a-ftp-poller--tp26004849p26004849.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> -----
>> ---
>> Gert Vanthienen
>> http://gertvanthienen.blogspot.com
>>
>
> --
> View this message in context: http://www.nabble.com/How-can-I-know-whether-a-file-is-received-completely-or-not-for-a-ftp-poller--tp26004849p26005619.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>