PostgreSQL Listen
PostgreSQL Listen data ingestion is available using ingress of type postgres.
Examples Repo
Example PostgreSQL Listen configuration files showcasing all features we will discuss can be found in our Examples Repo .
Settings
The Postgres settings in the configuration file are used to configure data ingestion from a PostgreSQL Notify/Listen channel.
Below is a detailed description of each field within the Postgres settings:
| Field | Required | Configurable | Description |
|---|---|---|---|
channel |
true |
true |
Postgres channel name to listen to. |
contentType |
false |
true |
The content type of the value, accepted types: json, recon, xml (default plaintext). |
Under the hood, Nstream uses a Hikari connection pool to configure and create connections.
Any properties that can be set directly on a HikariConfig object can also be passed here as a setting, some common examples:
| Field | Required | Configurable | Description |
|---|---|---|---|
jdbcUrl |
false |
true |
JDBC URL of the Postgres database. |
datasource.user |
false |
true |
Username used to obtain connections from Postgres. |
datasource.password |
false |
true |
Password used to obtain connections from Postgres. |
Message Structure
The message structure of received Postgres notifications is:
{ "channel": ..., "payload": {...} }
Example
The configuration below defines a Postgres Listen ingress where notifications are consumed from the specified Postgres channel and relayed to vehicle agents.
{
"ingress": {
"type": "postgres",
"settings": {
"jdbcUrl": "jdbc:postgresql://host.docker.internal:5432/mydb",
"dataSource.user": "postgres",
"dataSource.password": "postgres",
"channel": "new-vehicles"
},
"relay": {
"agent": "vehicle",
"idExtractor": "payload",
}
}
}
Nstream is licensed under the Redis Source Available License 2.0 (RSALv2).