Router configuration
How to configure the router config.yml for your NATS event provider.
Defining a NATS provider
All event providers are defined under events.sources
:
Each named property under events.sources
corresponds to a sourceName
argument that is defined by an events directive. If no sourceName is provided, the default value, "default", is used. If an events directive defines a sourceName
argument that is not defined in the router config.yml, the router will return an error and fail to start.
Required Properties
The following properties are always required:
Property name | Type | Value |
---|---|---|
provider | enum | NATS |
url | string | your NATS server url |
Authentication (optional)
The authentication property is optional; however, if it is defined, either a token
, or a username
and password
pair must be provided:
Authentication property name | Type | Value | Additional requirements |
---|---|---|---|
token | string | your NATS server token | no username nor password property |
username | string | your NATS server username | no token property; password property |
password | string | your NATS server password | no token property; username property |
Example configuration
Consider the following Event-Driven Graph schema SDL and its corresponding router config.yml:
The Subscription.userUpdated
field defines no sourceName
argument; therefore, it corresponds to events.sources.default
in the config.yml.
The Subscription.userUpdatedTwo
field defines the value "anotherNats" for its sourceName
argument; therefore, it corresponds to events.sources.default
in the router config.yml.
Last updated