Skip to content

Add redis doc #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,8 @@
"router/event-driven-federated-subscriptions-edfs/nats/stream-and-consumer-configuration"
]
},
"router/event-driven-federated-subscriptions-edfs/kafka"
"router/event-driven-federated-subscriptions-edfs/kafka",
"router/event-driven-federated-subscriptions-edfs/redis"
]
},
"router/compliance-and-data-management",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Composition Rules"
description: "The Event-Driven Graph (or EDG) is an \"abstract\" subgraph, so it must not define any resolvers. EDGs are also subject to special compositional rules."
description: "The Event-Driven Graph (or EDG) is an "abstract" subgraph, so it must not define any resolvers. EDGs are also subject to special compositional rules."
icon: "network-wired"
---

Expand All @@ -13,8 +13,10 @@ EDG Root fields must define their respective event directive and a valid respons
| Query | @edfs__natsRequest | A non-nullable entity object |
| Mutation | @edfs__natsPublish | `edfs__PublishResult!` |
| | @edfs__kafkaPublish | `edfs__PublishResult!` |
| | @edfs__redisPublish | `edfs__PublishResult!` |
| Subscription | @edfs__natsSubscribe | A non-nullable entity object |
| | @edfs__kafkaSubscribe | A non-nullable entity object |
| | @edfs__redisSubscribe | A non-nullable entity object |

Note that the `edfs__NatsStreamConfiguration` input object must _always_ be defined to satisfy the `@edfs__natsSubscribe` directive:

Expand Down
48 changes: 48 additions & 0 deletions docs/federation/event-driven-federated-subscriptions/redis.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: "Redis"
icon: "sitemap"
---

## Definitions

<Note>
The `providerId` argument, including the default value "default", _must_ correspond to an equivalent property in _events.providers.redis_ entry of the router config.yml.
</Note>

### @edfs_kafkaPublish

```js
directive @edfs__redisPublish(
channel: String!,
providerId: String! = "default"
) on FIELD_DEFINITION

type edfs__PublishResult {
success: Boolean!
}
```

| Argument name | Type | Value |
| ------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| channel | String\! | The event channel. |
| providerId | String\! | The provider ID, which identifies the connection in the router config.yaml. <br />If unsupplied, the provider ID "default" will be used. |

### @edfs__redisSubscribe

```js
directive @edfs__redisSubscribe(
channels: [String!]!,
providerId: String! = "default"
) on FIELD_DEFINITION
```

| Argument name | Type | Value |
| ------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| channels | [String\!]\! | The event channels. It is possible to subscribe to multiple topics.<br />Also, subscription is done using `PSUBSCRIBE `so some pattern matching can be used, as per redis documentation: https://redis.io/docs/latest/commands/psubscribe/. |
| providerId | String\! | The provider ID, which identifies the connection in the router config.yaml. <br />If unsupplied, the provider ID "default" will be used. |

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

</Card>
</CardGroup>
Binary file added docs/image(1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/image-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 41 additions & 30 deletions docs/router/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ The following sections describe each configuration in detail with all available
<Info>
Intervals, timeouts, and delays are specified in Go [duration](https://pkg.go.dev/maze.io/x/duration#ParseDuration) syntax e.g 1s, 5m or 1h.

Sizes can be specified in 2MB, 1mib.

Sizes can be specified in 2MB, 1mib.
</Info>

| Environment Variable | YAML | Required | Description | Default Value |
Expand Down Expand Up @@ -187,9 +186,9 @@ watch_config:
<Note>
Hot reloading has some limitations:

- Changes to the `watch_config` section are not hot-reloaded.
- Changes to flags and environment variables are not possible.
- `watch_config` based reloads are based on the filesystem's modification time, edits that somehow circumvent this mechanism will not trigger a reload.
- Changes to the `watch_config` section are not hot-reloaded.
- Changes to flags and environment variables are not possible.
- `watch_config` based reloads are based on the filesystem's modification time, edits that somehow circumvent this mechanism will not trigger a reload.
</Note>

## Access Logs
Expand Down Expand Up @@ -292,17 +291,17 @@ graph:

The Model Context Protocol (MCP) server allows AI models to discover and interact with your GraphQL API in a secure way.

| Environment Variable | YAML | Required | Description | Default Value |
| ------------------------------- | ------------------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
| MCP_ENABLED | mcp.enabled | <Icon icon="square" /> | Enable or disable the MCP server | false |
| MCP_SERVER_LISTEN_ADDR | mcp.server.listen_addr | <Icon icon="square" /> | The address and port where the MCP server will listen for requests | localhost:5025 |
| MCP_SERVER_BASE_URL | mcp.server.base_url | <Icon icon="square" /> | The base URL of the MCP server. This is the URL advertised to the LLM clients when SSE is used as primary transport. | - |
| MCP_ROUTER_URL | mcp.router_url | <Icon icon="square" /> | Custom URL to use for the router GraphQL endpoint in MCP. Use this when your router is behind a proxy. Purely metadata for AI model. | - |
| MCP_STORAGE_PROVIDER_ID | mcp.storage.provider_id | <Icon icon="square" /> | The ID of a storage provider to use for loading GraphQL operations. Only file_system providers are supported. | - |
| MCP_GRAPH_NAME | mcp.graph_name | <Icon icon="square" /> | The name of the graph to be used by the MCP server | mygraph |
| MCP_EXCLUDE_MUTATIONS | mcp.exclude_mutations | <Icon icon="square" /> | Whether to exclude mutation operations from being exposed | false |
| MCP_ENABLE_ARBITRARY_OPERATIONS | mcp.enable_arbitrary_operations | <Icon icon="square" /> | Whether to allow arbitrary GraphQL operations to be executed. <Warning>Security risk: Should only be enabled in secure, internal environments.</Warning> | false |
| MCP_EXPOSE_SCHEMA | mcp.expose_schema | <Icon icon="square" /> | Whether to expose the full GraphQL schema. <Warning>Security risk: Should only be enabled in secure, internal environments.</Warning> | false |
| Environment Variable | YAML | Required | Description | Default Value |
| ------------------------------- | ------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------- |
| MCP_ENABLED | mcp.enabled | <Icon icon="square" /> | Enable or disable the MCP server | false |
| MCP_SERVER_LISTEN_ADDR | mcp.server.listen_addr | <Icon icon="square" /> | The address and port where the MCP server will listen for requests | localhost:5025 |
| MCP_SERVER_BASE_URL | mcp.server.base_url | <Icon icon="square" /> | The base URL of the MCP server. This is the URL advertised to the LLM clients when SSE is used as primary transport. | - |
| MCP_ROUTER_URL | mcp.router_url | <Icon icon="square" /> | Custom URL to use for the router GraphQL endpoint in MCP. Use this when your router is behind a proxy. Purely metadata for AI model. | - |
| MCP_STORAGE_PROVIDER_ID | mcp.storage.provider_id | <Icon icon="square" /> | The ID of a storage provider to use for loading GraphQL operations. Only file_system providers are supported. | - |
| MCP_GRAPH_NAME | mcp.graph_name | <Icon icon="square" /> | The name of the graph to be used by the MCP server | mygraph |
| MCP_EXCLUDE_MUTATIONS | mcp.exclude_mutations | <Icon icon="square" /> | Whether to exclude mutation operations from being exposed | false |
| MCP_ENABLE_ARBITRARY_OPERATIONS | mcp.enable_arbitrary_operations | <Icon icon="square" /> | Whether to allow arbitrary GraphQL operations to be executed. <Warning> Security risk: Should only be enabled in secure, internal environments. </Warning> | false |
| MCP_EXPOSE_SCHEMA | mcp.expose_schema | <Icon icon="square" /> | Whether to expose the full GraphQL schema. <Warning> Security risk: Should only be enabled in secure, internal environments. </Warning> | false |

Example YAML config:

Expand Down Expand Up @@ -818,10 +817,10 @@ modules:

The configuration for the router gRPC plugins. To learn more about the gRPC plugins, see the [gRPC plugins documentation](/router/plugins).

| Environment Variable | YAML | Required | Description | Default Value |
| -------------------- | ------- | ---------------------- | ----------------------------------------------------------------------------------- | ------------- |
| PLUGINS_ENABLED | enabled | <Icon icon="square" /> | Enable the router plugins. If the value is true, the router plugins are enabled. | false |
| PLUGINS_PATH | path | <Icon icon="square" /> | The path to the plugins directory. The plugins directory is used to load the plugins.| plugins |
| Environment Variable | YAML | Required | Description | Default Value |
| -------------------- | ------- | ---------------------- | ------------------------------------------------------------------------------------- | ------------- |
| PLUGINS_ENABLED | enabled | <Icon icon="square" /> | Enable the router plugins. If the value is true, the router plugins are enabled. | false |
| PLUGINS_PATH | path | <Icon icon="square" /> | The path to the plugins directory. The plugins directory is used to load the plugins. | plugins |

### Example YAML config:

Expand All @@ -832,6 +831,7 @@ plugins:
enabled: true
path: "plugins"
```

## Headers

Configure Header propagation rules for all Subgraphs or individual Subgraphs by name.
Expand Down Expand Up @@ -1540,7 +1540,7 @@ cdn:

The Events section lets you define Event Sources for [Event-Driven Federated Subscriptions (EDFS)](/router/event-driven-federated-subscriptions-edfs).

We support NATS and Kafka as event bus provider.
We support NATS, Kafka and Redis as event bus provider.

<CodeGroup>

Expand All @@ -1567,15 +1567,19 @@ events:
username: "username"
brokers:
- "localhost:9092"
redis:
- id: my-redis
urls:
- "localhost:9092"
```

</CodeGroup>

### Provider

| Environment Variable | YAML | Required | Description | Default Value |
| -------------------- | --------- | --------------------------------------------- | ------------------- | ------------- |
| | providers | <Icon icon="square-check" iconType="solid" /> | one of: nats, kafka | |
| Environment Variable | YAML | Required | Description | Default Value |
| -------------------- | --------- | --------------------------------------------- | -------------------------- | ------------- |
| | providers | <Icon icon="square-check" iconType="solid" /> | one of: nats, kafka, redis | |

### NATS Provider

Expand All @@ -1602,7 +1606,12 @@ events:
| | tls | <Icon icon="square" /> | TLS configuration for the Kafka provider. If enabled, it uses SystemCertPool for RootCAs by default. | |
| | tls.enabled | <Icon icon="square" /> | Enable the TLS. | |

### Nats Provider
### Redis Provider

| Environment Variable | YAML | Required | Description | Default Value |
| :------------------- | :--- | :------- | :--------------------------------------------------------------------------------------- | :------------ |
| | id | | The ID of the provider. This have to match with the ID specified in the subgraph schema. | [] |
| | urls | | A list of redis instances URLS, e.g: `redis://localhost:6379/2` | |

## Router Engine Configuration

Expand Down Expand Up @@ -1632,12 +1641,13 @@ Configure the GraphQL Execution Engine of the Router.
| ENGINE_ENABLE_VALIDATION_CACHE | enable_validation_cache | <Icon icon="square" /> | Enable the validation cache. The validation cache is used to cache results of validating GraphQL Operations. | true |
| ENGINE_VALIDATION_CACHE_SIZE | validation_cache_size | <Icon icon="square" /> | The size of the validation cache. | 1024 |
| ENGINE_DISABLE_EXPOSING_VARIABLES_CONTENT_ON_VALIDATION_ERROR | disable_exposing_variables_content_on_validation_error | <Icon icon="square" /> | Disables exposing the variables content in the error response. This is useful to avoid leaking sensitive information in the error response. | false |
| ENGINE_ENABLE_SUBGRAPH_FETCH_OPERATION_NAME | enable_subgraph_fetch_operation_name | <Icon icon="square" /> | Enable appending the operation name to subgraph fetches. This will ensure that the operation name will be included in the corresponding subgraph requests using the following format: $operationName\_\_$subgraphName\_\_$sequenceID. | true |
| ENGINE_ENABLE_SUBGRAPH_FETCH_OPERATION_NAME | enable_subgraph_fetch_operation_name | <Icon icon="square" /> | Enable appending the operation name to subgraph fetches. This will ensure that the operation name will be included in the corresponding subgraph requests using the following format: $operationName\_\_$subgraphName_\_\$sequenceID. | true |
| ENGINE_SUBSCRIPTION_FETCH_TIMEOUT | subscription_fetch_timeout | <Icon icon="square" /> | The maximum time a subscription fetch can take before it is considered timed out. | 30s |

### Example YAML config:

<CodeGroup>

```yaml config.yaml
version: "1"

Expand Down Expand Up @@ -1665,7 +1675,8 @@ engine:
disable_exposing_variables_content_on_validation_error: false
enable_subgraph_fetch_operation_name: true
subscription_fetch_timeout: 30s
````
```

</CodeGroup>

### Debug Configuration
Expand Down Expand Up @@ -1712,7 +1723,7 @@ engine:
enable_normalization_cache_response_header: false
always_include_query_plan: false
always_skip_loader: false
````
```

</CodeGroup>

Expand Down Expand Up @@ -1972,7 +1983,7 @@ This configuration is used to enable full compatibility with Apollo Federation,

### Apollo Compatibility Value Completion

Invalid \_\_typename values will be returned in extensions.valueCompletion instead of errors.
Invalid \__typename values will be returned in extensions.valueCompletion instead of errors.

### Apollo Compatibility Truncate Floats

Expand Down Expand Up @@ -2104,4 +2115,4 @@ cache_warmup:
path: "./cache-warmer/operations"
```

</CodeGroup>
</CodeGroup>
Loading