Service
pouryakit-service, one Module in a Host of its own process, receiving another Host's Integration Events and Snapshots over RabbitMQ.
What it is
pouryakit-service generates the composition the Proving Sample's Inventory.Host runs: the Inventory Module alone, in a Host with its own database, receiving what Catalog publishes in another Host over a RabbitMQ broker. It holds the Host, its service defaults, Inventory, Catalog.Contracts for what it receives, and a smoke test.
A Host that receives needs its broker
The service always joins its RabbitMQ broker, under the service name the template derives from -n. Start it before the Host that publishes, so its queue exists first: A Host that receives.
When to use it
When you split a Module out of a modular monolith into a process of its own, as Inventory is split out in the Proving Sample. Inside one Host, keep the Module in the modular monolith: In-process or RabbitMQ weighs the two.
Generate and run it
Generate it
dotnet new pouryakit-service -n Acme.StockGive it PostgreSQL and a broker
Its appsettings.json names a database and a broker of its own, it migrates Inventory alone, and its launch profile listens on ports of its own, so it runs beside a monolith or a modular monolith: The service. Running the generated Host has the PostgreSQL and migration commands; the broker is any RabbitMQ that connection string reaches.
Publish from another Host
The publishing Host configures its broker and a service name of its own; a product Catalog creates there opens its stock item here. A Host that receives shows what the service declares to receive it.
What it composes
| Stated in | |
|---|---|
| Only what the service needs: no Catalog, monolith Host or Reverse proxy | The service |
Receive and ReceiveSnapshot for the wire names Catalog publishes | The service |
| One read, the stock item, to an authenticated caller of its tenant | The service |
| Delivery between the two Hosts | The service |