Skip to main content
1-Visitor
December 6, 2017
Solved

How to get notified when a file transfer is complete

  • December 6, 2017
  • 3 replies
  • 6845 views

Hi,

does anyone know how I can hook into a file transfer job complete event. I have a mash up which can kick start a file transfer from the edge to a file repository thing. Is there a way that I can hook into a notification that the transfer was completed successfully?

I am using the  FileTransferSubsystem Copy service to do the actual transfer. I can see that one of the parameters for the service is ​async​ which is currently set to false.

async - Should the service wait for the copy to complete - BOOLEAN


I would prefer not to wait for the transfer complete in the service if possible as files might be quite large.

I notice that the copy service returns a result  - INFOTABLE - Aspects {dataShape:FileTransferJob} . Is there some way I can use this. I thought maybe I could use the transferId​ parameter and a timer to check if the job was done by using FileTransferSubsystem IsTransferJobActive ​service? Likewise it would also be good to know if it failed.

Thanks,

K

Best answer by ttielebein

On the file repository thing, there is an event called FileTransfer. You just need to subscribe to this, and then there are different statuses which will be returned into the subscription, e.g. "VALIDATED" if it completed successfully, "ERROR" if it did not complete, or "ACTIVE" if the file transfer is started and ongoing. There is a similar approach which checks other event data instead of status in KCS here. Hope this helps!

3 replies

5-Regular Member
December 6, 2017

On the file repository thing, there is an event called FileTransfer. You just need to subscribe to this, and then there are different statuses which will be returned into the subscription, e.g. "VALIDATED" if it completed successfully, "ERROR" if it did not complete, or "ACTIVE" if the file transfer is started and ongoing. There is a similar approach which checks other event data instead of status in KCS here. Hope this helps!

khayes11-VisitorAuthor
1-Visitor
December 7, 2017

Hi Tori,

thanks for that, extremely helpful. I can see how I can get the file repository to subscribe to the events now. I do have one further question, do you have any idea how can get my mashup to respond to a 'file transfer complete' event? The only way I can think of, is to poll the file repository on a timer but ideally I'd like to respond to the event directly rather than have to keep polling. Is there any way at all to get a mashup to subscribe to events?

K

5-Regular Member
December 7, 2017

I am a bit confused; what exactly do you want the mashup to do with the event information?

1-Visitor
December 7, 2017

Hi Kieron,

The only way to get a Mashup notified (push rather than poll) by a server side "event change" it's through property update changes . Then, for instance, you will have to add a property on the FileRepository, let's call it nUploads as INTEGER, and on the event that you subscribed before just add up +1 to the nUploads property, then from the mashup you can push "subscribe" to this nUploads property in order to refresh the Mashup.

Best Regards,

Carles.

khayes11-VisitorAuthor
1-Visitor
December 7, 2017

Hi Carles,

thanks for the help. Not sure what you mean by 'push subscribe'. do you mean using a timer to poll the 'nUploads' parameter, or is there a way in a mash up to subscribe to this property's data change event?

K

1-Visitor
December 7, 2017

Hi Kieron, yes there's a method to "subscribe to property's data change event" please follow the link referenced on my previous post

khayes11-VisitorAuthor
1-Visitor
December 7, 2017

Thanks Carles, as usual you have been very helpful.

K