damianiandrea / mongodb-nats-connector

A connector that uses MongoDB's change streams to capture data changes and publishes those changes to NATS JetStream.
MIT License
49 stars 7 forks source link

Invalidate change event crashes the connector #14

Closed damianiandrea closed 9 months ago

damianiandrea commented 9 months ago

When a watched collection is dropped or renamed, MongoDB sends an invalidate change event.

Such change event causes the connector to close the change stream and try to resume from the latest resume token, only for it to error out and crash.

In order to fix this problem this PR prevents the connector from resuming a change stream after it has received an invalidate event.