You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+46
Original file line number
Diff line number
Diff line change
@@ -172,6 +172,52 @@ To make sure that the connection works, use [`psql`](https://www.postgresql.org/
172
172
173
173
By default, `gtfs-rt-feed` will connect as `gtfs-rt-$MAJOR_VERSION` to `localhost:4222` without authentication.
174
174
175
+
#### create NATS stream & consumer
176
+
177
+
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
+
179
+
```shell
180
+
nats stream add \
181
+
# omit this if you want to configure more details
182
+
--defaults \
183
+
# collect all messages published to these subjects
184
+
--subjects='aus.istfahrt.>' \
185
+
# acknowledge publishes
186
+
--ack \
187
+
# with limited storage, discard the oldest limits first
188
+
--retention=limits --discard=old \
189
+
--description='VDV-454 AUS IstFahrt messages' \
190
+
# name of the stream
191
+
AUS_ISTFAHRT_2
192
+
```
193
+
194
+
On the `AUS_ISTFAHRT_2` stream, we create a durable [consumer]():
195
+
196
+
```shell
197
+
nats consumer add \
198
+
# omit this if you want to configure more details
199
+
--defaults \
200
+
# create a pull-based consumer (refer to the NATS JetStream docs)
201
+
--pull \
202
+
# let gtfs-rt-feed explicitly acknowledge all received messages
203
+
--ack=explicit \
204
+
# let the newly created consumer start with the latest messages in AUS_ISTFAHRT_2 (not all)
205
+
--deliver=new \
206
+
# send gtfs-rt-feed at most 200 messages at once
207
+
--max-pending=200 \
208
+
# when & how often to re-deliver a message that hasn't been acknowledged (usually because it couldn't be processed)
209
+
--max-deliver=3 \
210
+
--backoff=linear \
211
+
--backoff-steps=2 \
212
+
--backoff-min=15s \
213
+
--backoff-max=2m \
214
+
--description 'OpenDataVBB/gtfs-rt-feed' \
215
+
# name of the stream
216
+
AUS_ISTFAHRT_2 \
217
+
# name of the consumer
218
+
gtfs-rt-feed
219
+
```
220
+
175
221
#### configure access to Redis
176
222
177
223
`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