Serhii Shliakhov
Serhii Shliakhov

Reputation: 2769

Do not repeat acknowledged events after reconnect to persistent connection in EventStore

I'm using Eventstore 20.6.1.0 And this client https://github.com/EventStore/EventStore-Client-NodeJS When I publish events to eventstore and acknowledge them in subscriber like this

      const onEvent = 
        (event: ResolvedEvent, report: PersistentReport) => {
          if (event.event) {
            report.ack(event.event.id);
          }
        }

If I disconnect from eventstore and reconnect again I receive all acknowledged events again

Why I receive acknowledged events, but not only new?

Upvotes: 1

Views: 177

Answers (1)

Serhii Shliakhov
Serhii Shliakhov

Reputation: 2769

When you create persistent connection you have to set max checkpoint count. In my case I've sent less events than maxCheckpointCount and they were not acknowledged before disconnect. That's why after reconnect I received them again.

    await createPersistentSubscription(streamName, groupName)
      .fromStart()
      .enableLinkResolution()
      .consumerStrategy(ROUND_ROBIN)
      .maxCheckpointCount(1)
      .minCheckpointCount(1)
      .execute(connection)

Upvotes: 2

Related Questions