How continuous Azure Web Jobs can be idempotent and send email? -


after reading tons of information on web azure webjobs, documentation says job should idempotent, on other hand, blogs use webjobs actions such "charging customer", "sending e-mail".

this documentation says running continuous webjob on multiple instances queue result in being called more once. people ignore fact charge customer twice, or send e-mail twice?

how can make sure can run webjob queue on scaled web app , messages processed once?

i using database, update query row lock , transactionscope object.

in order table, create column manage state of action taking in webjob. i.e. emailsent.

in queuetrigger function begin transaction, execute update query on customer order rowlock set, sets emailsent = 1 emailsent = 0. if return value sqlcommand = 0 exit function. webjob has sent email. otherwise, send email , call complete() on transactionscope object if sent successfully.

that should provide idempotency want.

hope helps.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -