Skip to content

Commit 12fc305

Browse files
committed
matching: expect GTFS_RT_2 stream & consumer to be created by the user 💥📝
1 parent b6400fd commit 12fc305

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

lib/match.js

-13
Original file line numberDiff line numberDiff line change
@@ -339,19 +339,6 @@ const runGtfsMatching = async (cfg, opt = {}) => {
339339
streamInfo,
340340
}, 'using NATS JetStream stream for AUS IstFahrts')
341341
}
342-
{
343-
// create/update NATS JetStream stream for GTFS-RT data
344-
const streamInfo = await natsJetstreamManager.streams.add({
345-
name: NATS_JETSTREAM_GTFSRT_STREAM_NAME,
346-
subjects: [
347-
GTFS_RT_TOPIC_PREFIX + '>',
348-
],
349-
// todo: limits?
350-
})
351-
serviceLogger.debug({
352-
streamInfo,
353-
}, 'created/re-used NATS JetStream stream for GTFS-RT data')
354-
}
355342

356343
const istFahrtsConsumer = await natsJetstreamClient.consumers.get(
357344
NATS_JETSTREAM_AUS_ISTFAHRT_STREAM_NAME,

readme.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ By default, `gtfs-rt-feed` will connect as `gtfs-rt-$MAJOR_VERSION` to `localhos
175175

176176
#### create NATS stream & consumer
177177

178-
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):
178+
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):
179179

180180
```shell
181181
nats stream add \
@@ -192,7 +192,7 @@ nats stream add \
192192
AUS_ISTFAHRT_2
193193
```
194194

195-
On the `AUS_ISTFAHRT_2` stream, we create a durable [consumer]():
195+
On the `AUS_ISTFAHRT_2` stream, we create a durable [consumer](https://docs.nats.io/nats-concepts/jetstream/consumers) called `gtfs-rt-feed`:
196196

197197
```shell
198198
nats consumer add \
@@ -219,6 +219,23 @@ nats consumer add \
219219
gtfs-rt-feed
220220
```
221221

222+
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:
223+
224+
```shell
225+
nats stream add \
226+
# omit this if you want to configure more details
227+
--defaults \
228+
# collect all messages published to these subjects
229+
--subjects='gtfsrt.>' \
230+
# acknowledge publishes
231+
--ack \
232+
# with limited storage, discard the oldest limits first
233+
--retention=limits --discard=old \
234+
--description='GTFS-RT messages' \
235+
# name of the stream
236+
GTFS_RT_2
237+
```
238+
222239
#### configure access to Redis
223240

224241
`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).

0 commit comments

Comments
 (0)