Skip to main content
Network architecture with CMS, CRM, ERP, NATS, and routers connecting clients

Network with NATS, routers, and clients

Minimum requirements

Full schema example

Here is a comprehensive example of how to use NATS with Cosmo Streams. This guide covers request, publish, subscribe directive. All examples can be modified to suit your specific needs. The schema directives and edfs__* types belong to the Cosmo Streams schema contract and must not be modified.
You can create the Event-Driven Graph (EDG—an abstract subgraph) with the following wgc command:

Router configuration

Based on the example above, you will need a compatible router configuration.

Example Query

In the example query below, one or more subgraphs have been implemented alongside the Event-Driven Graph to resolve any other fields defined on Employee, e.g., tag and details.surname. Event-Driven Graphs (EDGs) do not define resolvers, and can only define fields that compose an entity’s primary key(s).

System diagram

Service initiating event subscription to NATS, router broadcasting to clients

NATS subscription flow from service to clients