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
Post a Comment