Book Image

Learning Microsoft Azure

By : Geoff Webber Cross, Geoff Webber-Cross
Book Image

Learning Microsoft Azure

By: Geoff Webber Cross, Geoff Webber-Cross

Overview of this book

Table of Contents (19 chapters)
Learning Microsoft Azure
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a scheduled work activity


We've got most of the production worker role completed with orders safely being inserted into the production database, but there's a bit missing, and we have a slight problem with it.

The production order processor must create product batch schedules and allocate stock for the production management application. We don't want to perform this operation every time an order message comes in, as it will put too much load on the system. Also, when we have multiple roles running as we scale out, we don't want to get database contention from multiple instances trying to work on the same records in the database. Pessimistic and optimistic concurrency will not even help us here as we need to create single new batches when existing batches are full as well as adding to existing incomplete batches.

To solve this problem, we need a way of only one role performing these activities at any one time and a way of requesting the scheduled activities. Azure gives us a number...