Skip to main content

Using queries in services

Services can either send or receive queries.

To add queries 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 query this service can receive
- id: GetOrder
# The version of the message you want to add.
version: 0.0.1
sends:
# id of the query this service requests/sends
- id: GetInventoryStatus
# The version of the message you want to add.
version: 0.0.1
---

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

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

Versioning​

When you reference an query in your service you need to specify the version of the query.

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

This can be useful for migration plans and understanding which version of your queries 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.