11.7 Run both
In one terminal, the hub:
dotnet run --project Shopfront.Hub --urls http://localhost:5080In a second, the worker:
dotnet run --project Shopfront.Worker --urls http://localhost:5081Place an order as ada. PlaceOrder answers as soon as the order is confirmed, and the hub's log
shows fulfilment queued:
info: Shopfront.Trains.PlaceOrder.Junctions.QueueFulfilmentJunction[0]
Queued fulfilment of 8fb0141d-1862-413b-9be1-b3940eef2453 as work queue entry 2The worker's log picks it up and packs it, ten seconds later:
info: Shopfront.Trains.FulfilOrder.Junctions.PackOrderJunction[0]
Packing order 8fb0141d-1862-413b-9be1-b3940eef2453
info: Shopfront.Trains.FulfilOrder.Junctions.PackOrderJunction[0]
Packed order 8fb0141d-1862-413b-9be1-b3940eef2453 as PKG-8FB0141DIn the console, Cluster now lists two processes, each named by its machine and process id, with how many runs each has run. Executions records the machine each run ran on; on one machine that is the same name for both, and on separate machines it tells them apart.
The supplier switch from chapter 10 is still on the hub, and the restock now runs on the worker, whose fake supplier never hears about it. A fake's state lives in one process; the supplier a real shop uses does not.
SDK Reference
AddTraxWorker | ITrainExecutionService | Queued work | Job submission | Structuring your application | Host tracking