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
- One library, two processes
- The projects
- Fulfilment is a train
- PlaceOrder queues it
- The hub
- The worker
- Run both
- Kill the worker mid-run
- Test it
SDK Reference
AddTraxWorker | ITrainExecutionService | Queued work | Job submission | Structuring your application | Host tracking