简体   繁体   中英

WCF filestream queue

I am trying to create a web-service, that would be able to receive a file from client, process it (for example open the txt file, change the values somehow etc.) and then provide it to client after it is processed.

The things I have done so far is that I have a service+host and WinForm application for client, that is able to choose file, send it and then get the list of files that are stored on served and manualy download selected file back (Im using WCF streaming).

Next thing I need to do is create some sort of queue - it would be nice to have the file download process from server automated. But there is also possibility, that before the server manage to process the file from client, the client could go (intetionaly or not) offline and thus the server would not be able to send the file back.

I checked some manuals and tutorial and found out, that there is a built-in technology called MSMQ, that could be used in WCF - it simply put the data in queue, if the client/server is not avaiable atm and attempt to send them later. The only problem is, that in each manual, they are working only with methods (they put methods call in queue) but not with files.

My question is - is it possible to implement MSMQ with file streaming somehow? Or should I choose different approach?

Thank you in advance

Your web service shouild save the uploaded image to a directory on your server and then return a JobID to the webpage. The web service method could also then post a message using System.Messaging with that JobID (and all relevant file info, etc) to an MSMQ queue. You can then write a WCF service that uses MSMQIntegration Binding to listen to this queue. You would write a method in this service that would perform whatever operations you wish to perform on the file, and the method would automatically take the message off the queue, or if the service was offline, the messages would remain there until this service is back online.

Does this address your needs?

:) David

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM