Skip to main content
⭐️ If you love EventCatalog, give it a star on GitHub. Thanks!

Adding messages to services

EventCatalog supports different types of messages (commands and events) (soon support for queries).

A service in EventCatalog can receive or send messages.

Example



What about producers and consumers?

If you are coming from an event-driven architecture you will be familiar with the terms producers and consumers. Producers produce events and consumers consume them.

EventCatalog services can be either producers or consumers or both. For example if a service receives an event (type of message) it is the consumer, if it sends an event (type of message) it is the producer.

The idea of sends and receives comes from the AsyncAPI specification and gives flexibility to support other types of messages (commands and queries).

To add messages to your service you first have to define your messages.

Once you have messages defined in your Catalog you can reference them within your service.

Adding messages to your service

To add messages to a service you need to define them in either the sends or receives array within your service frontmatter API.

You need to add the id and version of the message.

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

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

The receives and sends fields in your service tell EventCatalog which messages this service either consumes or publishes.

The power of versioning

When you define your messages for your service you can define the version of them too. This can be powerful if you have multiple versions of your events, commands or queries. Example could be an API that you are consuming, maybe you are consuming an old version of this API you can specify that.

Visualizing messages within a service

When messages get added within your services EventCatalog will visualize this for you either using the NodeGraph component or through the visualizer.

Example