Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows service design
    primarykey
    data
    text
    <p>Imagine the following situation. Windows service from time to time checks the data in database table. When some new data appears, it starts processing each new row.</p> <p>The processing consists of several logical stages, let it be: </p> <ul> <li>get some additional data from web service;</li> <li>find an existins object via web service by data from stage 1 or create a new object;</li> <li>inform an interested person of the actions done (with details about the object that was found/created on stage 2);</li> <li>do smth else.</li> </ul> <p>Just for now if any exception happens, the service updates the DB row and sets a flag indicating that a mistake has happened. Some time later service will try to process the row once again... and here is the problem.</p> <p>Processing will start from the very beginning, from stage 1. In this case if exception happened on stage 4 and if it will happen again and again the interested person from stage 3 will be informed again and again and again...</p> <p>To completely stop row processing in case of exception is not possible and not desirable in my situation. Ideally it would be nice if there was a way to start processing from the stage where it failed last time.</p> <p>Now I need your advice how all these can be handled. In fact, everything is even more complicated, because there are several patterns of processing, different number of stages and so on. </p> <p>Thanks in advance.</p> <p><strong>UPDATE</strong> </p> <p>Yes, I have the State parameter in data rows :) It is just not used just for now. And exception handling is not a new thing for me.</p> <p>The question is: what is the best way to handle state switching? In other words to make a clear logical link between stage number and processing method? The flow of execution can be very diffirent and include various number of stages and methods for different rows.</p> <p>I hope, there are more pleasant ways than writing endless switch/case blocks for every new sutiation?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload