3

I'll preface this by saying that I'm not particularly familiar with writing http services.

To keep things simple, I'll use the metaphor of creating a collages from images selected by the user. The collage creation takes some time because a fair amount of image processing is done. Let's say that it takes 10 minutes to produce the output. Again, this isn't the actual application but works, hopefully, for the point of this discussion.

My goal is that I don't want to require the user to worry about being "done" with creating the collage or to have to click some "OK" button to queue up generation of the collage. Rather, the collage generator runs against an input set of images and produces a collage based on whatever has recently been selected by the user. S/he can add/remove images from the input set whenever s/he wants to and at some point a new collage will be produced.

The user can make multiple collages from images anytime s/he wants. Imagine that there's a "Bobby's baseball games" collage and "Family Vacations" collage. Hopefully you get the idea here. Anytime I want to add to a particular collage I just specify which images to add and I'm done.

The application being used for the selection of the images neither knows nor cares how the collage generator works. To decouple these two applications, I have a http service that receives the additions/deletions from the user. It takes those inputs and persists them. To keep things simple, the service sets a 'dirty' flag and timetags any new entries to the collage. This allows the CollageGenerator to know if a collage needs to be redone.

Now... to my actual question.

I could write CollageGenerator as a windows service that, on some periodic basis, looks for work to do. This is pretty straightforward and it could also be a simple application that is called by the Windows Task Scheduler. Either of those solutions is essentially the same solution.

But, could the http service also accomplish the same thing by firing off a thread with a timer and doing the checking later?

I recognize that generally what happens with these http services is that they are called, do something and then return some result. But can it also spawn off a separate thread to do timer-related background task work?

Again, still learning about http services so my question might be very much out of left field.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.