Skip to main content

Using commands in services

Services can either send or receive commands.

To add commands to services you need to reference them within your service itself.

/services/Orders/index.md (example)
---
id: OrderService
... # other service frontmatter
receives:
# id of the command this service receives
- id: AdjustInventory
# The version of the message you want to add.
version: 0.0.1
sends:
# id of the event this service sends
- id: InventoryAdjusted
# The version of the message you want to add.
version: 0.0.1
---

<!-- Markdown contents... -->

Read the guide to learn how to add commands to your services..

Versioning​

When you reference a command in your service you need to specify the version of the command.

This allows you to document which versions of commands your service interacts with.

This can be useful for migration plans and understanding which version of your commands are being used in your architecture.

Always using the latest version

Referencing a message version is optional from your service. If no version is given then the latest is always used.