Tutorial

11. A separate worker

Once an order is paid, someone has to pack it. Packing takes a while, and the customer should not wait for it, so PlaceOrder queues it and answers. In this chapter fulfilment becomes queued work, and every piece of work nobody waits for, the queued packing and the scheduled jobs from the last two chapters, moves to a process of its own: a worker. The process customers talk to only takes requests and schedules.

Then we kill the worker in the middle of packing an order, and see what Trax does about it.

This chapter starts from the end of chapter 10.

In this chapter

  1. One library, two processes
  2. The projects
  3. Fulfilment is a train
  4. PlaceOrder queues it
  5. The hub
  6. The worker
  7. Run both
  8. Kill the worker mid-run
  9. Test it

SDK Reference

AddTraxWorker | ITrainExecutionService | Queued work | Job submission | Structuring your application | Host tracking


Next: 11.1 One library, two processes