Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mintlify install
- **Namespaces**: Environment isolation for graphs (dev, staging, prod)
- **Feature Flags & Feature Subgraphs**: Toggle-able subgraph replacements for incremental rollout
- **Schema Contracts**: Filtered graph versions using @tag directives
- **EDFS**: Event-Driven Federated Subscriptions for real-time data
- **Cosmo Streams / EDFS**: Event-Driven Federated Subscriptions for real-time data

## Documentation Structure

Expand Down
33 changes: 24 additions & 9 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,21 +216,30 @@
]
},
{
"group": "Event-Driven Federated Subscriptions (EDFS)",
"icon": "calendar-users",
"group": "Cosmo Streams (EDFS)",
"icon": "wave",
"pages": [
"router/event-driven-federated-subscriptions-edfs",
"router/cosmo-streams",
{
"group": "NATS",
"icon": "puzzle-piece",
"pages": [
"router/event-driven-federated-subscriptions-edfs/nats",
"router/event-driven-federated-subscriptions-edfs/nats/stream-and-consumer-configuration"
"router/cosmo-streams/nats",
"router/cosmo-streams/nats/stream-and-consumer-configuration"
]
},
"router/event-driven-federated-subscriptions-edfs/kafka",
"router/event-driven-federated-subscriptions-edfs/redis",
"router/event-driven-federated-subscriptions-edfs/custom-modules"
"router/cosmo-streams/kafka",
"router/cosmo-streams/redis",
{
"group": "Custom Modules",
"icon": "cubes",
"pages": [
"router/cosmo-streams/custom-modules",
"router/cosmo-streams/custom-modules/subscription-on-start",
"router/cosmo-streams/custom-modules/on-receive-event",
"router/cosmo-streams/custom-modules/on-publish-event"
]
}
]
},
"router/compliance-and-data-management",
Expand Down Expand Up @@ -738,5 +747,11 @@
"gtm": {
"tagId": "GTM-5GPL7DQH"
}
}
},
"redirects": [
{
"source": "/router/event-driven-federated-subscriptions-edfs/:path*",
"destination": "/router/cosmo-streams/:path*"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ input openfed__SubscriptionFilterCondition {

## Overview

The `@openfed__subscriptionFilter` directive declares that a field definition can be filtered by filter conditions. The directive can only be applied to [EDFS](/federation/event-driven-federated-subscriptions) subscriptions.
The `@openfed__subscriptionFilter` directive declares that a field definition can be filtered by filter conditions. The directive can only be applied to [EDG](/federation/event-driven-federated-subscriptions) subscriptions.

## Arguments

Expand Down
2 changes: 1 addition & 1 deletion docs/federation/event-driven-federated-subscriptions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ icon: circle-info

Defining an Event-Driven Graph with Event-Driven Federated Subscriptions.

An Event-Driven Graph (EDG) is best thought to be an abstract subgraph that facilitates Event-Driven Federated Subscriptions (EDFS). If a subgraph uses or defines any event driven directives, it will be interpreted to be an Event-Driven Graph.
An Event-Driven Graph (EDG) is best thought to be an abstract subgraph that facilitates [Cosmo Streams](/router/cosmo-streams). If a subgraph uses or defines any event driven directives, it will be interpreted to be an Event-Driven Graph.


4 changes: 2 additions & 2 deletions docs/router/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ This option may change or be removed in future versions as the OpenTelemetry SDK
| METRICS_OTLP_EXCLUDE_METRIC_LABELS | exclude_metric_labels | <Icon icon="square" /> | The metric labels to exclude from the OTEL metrics. Accepts a list of Go regular expressions. Use https://regex101.com/ to test your regular expressions. | [] |
| METRICS_OTLP_CONNECTION_STATS | connection_stats | <Icon icon="square" /> | Enable connection metrics. | false |
| METRICS_OTLP_CIRCUIT_BREAKER | circuit_breaker | <Icon icon="square" /> | Ensure that circuit breaker metrics are enabled for OTEL. | false |
| METRICS_OTLP_STREAM | streams | <Icon icon="square" /> | Enable EDFS stream metrics. | false |
| METRICS_OTLP_STREAM | streams | <Icon icon="square" /> | Enable Cosmo Streams metrics. | false |

### Attributes

Expand Down Expand Up @@ -662,7 +662,7 @@ telemetry:
| PROMETHEUS_EXCLUDE_METRIC_LABELS | exclude_metric_labels | <Icon icon="square" /> | | |
| PROMETHEUS_EXCLUDE_SCOPE_INFO | exclude_scope_info | <Icon icon="square" /> | Exclude scope info from Prometheus metrics. | false |
| PROMETHEUS_CIRCUIT_BREAKER | circuit_breaker | <Icon icon="square" /> | Enable the circuit breaker metrics for prometheus metric collection. | false |
| PROMETHEUS_OTLP_STREAM | streams | <Icon icon="square" /> | Enable EDFS stream metrics. | false |
| PROMETHEUS_OTLP_STREAM | streams | <Icon icon="square" /> | Enable Cosmo Streams metrics. | false |

### Example YAML config:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Event-Driven Federated Subscriptions (EDFS)"
description: "EDFS combines the power of GraphQL Federation and Event-Driven Architecture (Kafka, NATS, Redis) to update a user GraphQL Subscription after an event occurs in your system."
title: "Cosmo Streams (EDFS)"
description: "Cosmo Streams (formally known as EDFS) combines the power of GraphQL Federation and Event-Driven Architecture to update a user GraphQL Subscription after an event occurs in your system."
icon: "circle-info"
sidebarTitle: "Overview"
---
Expand All @@ -9,7 +9,7 @@ sidebarTitle: "Overview"
![](/images/router/EDFS.png)
</Frame>

Event Driven Federated Subscriptions (EDFS) solves 3 major problems when it comes to GraphQL Federation and Subscriptions by directly connecting the Router to an event source like Kafka and NATS and making it a part of the Graph.
Cosmo Streams solves 3 major problems when it comes to GraphQL Federation and Subscriptions by directly connecting the Router to an event source like Kafka and NATS and making it a part of the Graph.

## Intro

Expand Down Expand Up @@ -38,18 +38,18 @@ Furthermore, classic Subscriptions with Federation are quite expensive when it c

## Specification

Enter Event-Driven Federated Subscriptions, a simple way to scale Federated Subscriptions in a resource-efficient manner.
Enter Cosmo Streams, a simple way to scale Federated Subscriptions in a resource-efficient manner.

EDFS supports three event providers:
Cosmo Streams supports three event providers:

<CardGroup cols={3}>
<Card title="Kafka" icon="sitemap" href="/router/event-driven-federated-subscriptions-edfs/kafka">
<Card title="Kafka" icon="sitemap" href="/router/cosmo-streams/kafka">

</Card>
<Card title="NATS" icon="puzzle-piece" href="/router/event-driven-federated-subscriptions-edfs/nats">
<Card title="NATS" icon="puzzle-piece" href="/router/cosmo-streams/nats">

</Card>
<Card title="Redis" icon="memory" href="/router/event-driven-federated-subscriptions-edfs/redis">
<Card title="Redis" icon="memory" href="/router/cosmo-streams/redis">

</Card>
</CardGroup>
Expand All @@ -58,7 +58,7 @@ Each provider consists of at least Publish and Subscribe capabilities. For NATS,

Our goal is to integrate with various technologies rather than agree on a single unified interface. This approach allows us to leverage the strengths of each technology. This philosophy is reflected in how we structure the directives, naming parameters, exposing features as they would appear in their respective ecosystems.

Here is an overview about all EDFS directives:
Here is an overview about all Cosmo Streams directives:

```js
# Nats and JetStream integration
Expand Down Expand Up @@ -120,7 +120,7 @@ An Event-Driven Subgraph does not need to be implemented. It is simply a Subgrap

## Prerequisites

To use EDFS, you need to have an Event Source running and connected to the Router. Currently, we support NATS, Kafka, and Redis. For simplicity, NATS is used to explain the examples.
To use Cosmo Streams, you need to have an Event Source running and connected to the Router. Currently, we support NATS, Kafka, and Redis. For simplicity, NATS is used to explain the examples.

To get started, run a NATS instance and add the following configuration to your `config.yaml` Router Configuration:

Expand Down Expand Up @@ -315,7 +315,7 @@ Here's an **invalid** message as the `__typename` field is missing:

</CodeGroup>

It's important to send the `__typename` field because this allows EDFS to also work for Union and Interface types.
It's important to send the `__typename` field because this allows Cosmo Streams to also work for Union and Interface types.

It's worth noting that the Router will not send any responses before you publish a message on the topic. If you need the most recent result, first make a Query, and then subscribe to the Topic. The Router will send the first response only after a message is published on the rendered topic.

Expand Down Expand Up @@ -437,11 +437,11 @@ The Cosmo Router deduplicates Subscriptions internally to save resources. If mul

### Statelessness of Subgraphs

With EDFS, the Router connects directly to the Event Source but doesn't require any stateful connections, e.g. WebSocket, to the Subgraphs. This makes the Subgraphs much simpler to reason about and easier to deploy. Serverless deployment options usually have limitations on request length. With an Event Broker in the middle, Subgraphs can be stateless without having to give up on Subscriptions.
With Cosmo Streams, the Router connects directly to the Event Source but doesn't require any stateful connections, e.g. WebSocket, to the Subgraphs. This makes the Subgraphs much simpler to reason about and easier to deploy. Serverless deployment options usually have limitations on request length. With an Event Broker in the middle, Subgraphs can be stateless without having to give up on Subscriptions.

### Efficiency, CPU & Memory Consumption (Epoll/Kqueue)

EDFS is built on top of Event-Driven principles, which means that the implementation is non-blocking, as CPU efficient as possible, and has a very low memory footprint.
Cosmo Streams is built on top of Event-Driven principles, which means that the implementation is non-blocking, as CPU efficient as possible, and has a very low memory footprint.

We're using Epoll and Kqueue on Systems that support it (Linux, Darwin, etc.) to be as efficient as possible.

Expand All @@ -451,10 +451,10 @@ The Router supports multi-core out of the box and is capable of scaling up to a

### Publish Events from any System, not just Subgraphs

It's worth noting that publishing Entity update Events is not limited to just Subgraphs. EDFS is designed to fully decouple the API Consumer from the implementation of the Event-Driven Architecture.
It's worth noting that publishing Entity update Events is not limited to just Subgraphs. Cosmo Streams is designed to fully decouple the API Consumer from the implementation of the Event-Driven Architecture.

A client can create a Job via a Mutation and Subscribe to the Job state via EDFS. Next, the Mutation can kick off a long-running process that will be handled by one or many systems in the background. At each step, e.g. when an increment of work is done, each subsystem can publish a message to indicate that the state of an Entity has changed.
A client can create a Job via a Mutation and Subscribe to the Job state via Cosmo Streams. Next, the Mutation can kick off a long-running process that will be handled by one or many systems in the background. At each step, e.g. when an increment of work is done, each subsystem can publish a message to indicate that the state of an Entity has changed.

Once the message is published by one of the sub-systems, the Router can Query all Subgraphs to resolve the current state of the Job.

With EDFS, each Subgraph can add fields to an Entity that it's responsible for and publish events to the Message Broker when a long-running Operation updates the overall state of an Entity.
With Cosmo Streams, each Subgraph can add fields to an Entity that it's responsible for and publish events to the Message Broker when a long-running Operation updates the overall state of an Entity.
17 changes: 17 additions & 0 deletions docs/router/cosmo-streams/custom-modules.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: "Custom Modules"
sidebarTitle: Overview
description: "Customize Streams behavior with powerful handlers for subscription lifecycle, event processing, and data transformation."
icon: "circle-info"
---

Cosmo Router provides powerful handlers to hook into the event processing of Cosmo Streams.
These handlers allow you to implement custom logic for subscription lifecycle management, event processing and data transformation.

## Available Hooks

The Cosmo Streams system provides three main hook interfaces that you can implement with [Custom Modules](/router/custom-modules):

- [`SubscriptionOnStartHandler`](/router/cosmo-streams/custom-modules/subscription-on-start): Called when a client subscribes
- [`OnReceiveEventHandler`](/router/cosmo-streams/custom-modules/on-receive-event): Called when events are received from a message broker
- [`OnPublishEventHandler`](/router/cosmo-streams/custom-modules/on-publish-event): Called when events are going to be sent to a message broker
Loading