From 12fc305312ef9b2e7526deeb63d962bac2542c8a Mon Sep 17 00:00:00 2001 From: Jannis R Date: Mon, 13 Jan 2025 12:08:51 +0100 Subject: [PATCH] =?UTF-8?q?matching:=20expect=20GTFS=5FRT=5F2=20stream=20&?= =?UTF-8?q?=20consumer=20to=20be=20created=20by=20the=20user=20?= =?UTF-8?q?=F0=9F=92=A5=F0=9F=93=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/match.js | 13 ------------- readme.md | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/match.js b/lib/match.js index de8be1d..fb49ec3 100644 --- a/lib/match.js +++ b/lib/match.js @@ -339,19 +339,6 @@ const runGtfsMatching = async (cfg, opt = {}) => { streamInfo, }, 'using NATS JetStream stream for AUS IstFahrts') } - { - // create/update NATS JetStream stream for GTFS-RT data - const streamInfo = await natsJetstreamManager.streams.add({ - name: NATS_JETSTREAM_GTFSRT_STREAM_NAME, - subjects: [ - GTFS_RT_TOPIC_PREFIX + '>', - ], - // todo: limits? - }) - serviceLogger.debug({ - streamInfo, - }, 'created/re-used NATS JetStream stream for GTFS-RT data') - } const istFahrtsConsumer = await natsJetstreamClient.consumers.get( NATS_JETSTREAM_AUS_ISTFAHRT_STREAM_NAME, diff --git a/readme.md b/readme.md index bd7c842..32ba601 100644 --- a/readme.md +++ b/readme.md @@ -175,7 +175,7 @@ By default, `gtfs-rt-feed` will connect as `gtfs-rt-$MAJOR_VERSION` to `localhos #### create NATS stream & consumer -We also need to create a [NATS JetStream](https://docs.nats.io/nats-concepts/jetstream) [stream](https://docs.nats.io/nats-concepts/jetstream/streams) called `AUS_ISTFAHRT_2` that `gtfs-rt-feed` will read (unmatched) GTFS-RT messages from. This can be done using the [NATS CLI](https://github.com/nats-io/natscli): +We also need to create a [NATS JetStream](https://docs.nats.io/nats-concepts/jetstream) [stream](https://docs.nats.io/nats-concepts/jetstream/streams) called `AUS_ISTFAHRT_2` that `gtfs-rt-feed` will read (unmatched) VDV-454 `AUS` `IstFahrt` messages from. This can be done using the [NATS CLI](https://github.com/nats-io/natscli): ```shell nats stream add \ @@ -192,7 +192,7 @@ nats stream add \ AUS_ISTFAHRT_2 ``` -On the `AUS_ISTFAHRT_2` stream, we create a durable [consumer](): +On the `AUS_ISTFAHRT_2` stream, we create a durable [consumer](https://docs.nats.io/nats-concepts/jetstream/consumers) called `gtfs-rt-feed`: ```shell nats consumer add \ @@ -219,6 +219,23 @@ nats consumer add \ gtfs-rt-feed ``` +Next, again using the NATS CLI, we'll create a stream called `GTFS_RT_2` that the `gtfs-rt-feed` service will write (matched) GTFS-RT messages into: + +```shell +nats stream add \ + # omit this if you want to configure more details + --defaults \ + # collect all messages published to these subjects + --subjects='gtfsrt.>' \ + # acknowledge publishes + --ack \ + # with limited storage, discard the oldest limits first + --retention=limits --discard=old \ + --description='GTFS-RT messages' \ + # name of the stream + GTFS_RT_2 +``` + #### configure access to Redis `gtfs-rt-feed` uses [`ioredis`](https://npmjs.com/package/ioredis) to connect to PostgreSQL; For details about supported environment variables and their defaults, refer to [its docs](https://github.com/redis/ioredis#readme).