Can I use WCF to replace my current Web Service and Window Service combination?
Posted
by gun_shy
on Stack Overflow
See other posts from Stack Overflow
or by gun_shy
Published on 2010-04-22T22:13:43Z
Indexed on
2010/04/22
22:33 UTC
Read the original article
Hit count: 182
I need a little bit of advise regarding the situation I am faced with. The current arrangement I have been tasked with improving just doesn't sit well with me and I feel like there is a better way to do it. The more I read about WCF, the more I get the feeling that it might be what I am looking for.
Right now, I have an asp.net client, a .net web service, a windows service, a ms sql database, and a third party application that is used for processing a group of 'project' files into a finalized file. Since the third party application can only handle processing one 'project' at a time, the combination of the web service, window service, and database have been arranged to create a job queue manager for the third party application.
The client sends a zip 'project' file containing multiple sub files to the web service. The web service adds a new 'project' line to the database, generating a unique job id. The zip file is expanded to a folder location on the server using the job id as the folder name. The web service then returns the job id to the client. The client will use this id to poll the web service for the status of the job submitted. When the job is complete, the client will request the processed file.
The windows service polls the database every x minutes. If a new job exists, the service will pull the oldest job and send it to the third party app for processing. If the processing succeeds, the window service updates the project line in the database, marking the job complete. The window service will continue to process any non complete jobs in the database until there are no more. When it stops finding any jobs, it will sleep x minutes and then poll the database again.
I do not like the fact that the window service has to poll the database. If there is only one job submitted, the client will have to wait for the window service to poll and then wait while the 'project' is being processed. It seems like WCF could be used to combine the web and window services using a combination of the InstanceContextMode.Single and ConcurrencyMode.Multiple. So far, I have been unable to find any articles or examples that would point me in the right direction. Can WCF be utilized to accomplish the job queue logic of the current arrangement in a better way? As always, any help is more than appreciated.
© Stack Overflow or respective owner