node-eventstore-client icon indicating copy to clipboard operation
node-eventstore-client copied to clipboard

Clarification of PersistentSubscriptionNakEventAction.Stop

Open quorak opened this issue 5 years ago • 4 comments

Hey there,

I'm having a PersistentSubscription and while catching up, I come into the situation, that I cannot process a certain Event. I would like to stop the persistentSubscription at the event where it is and continue at a later point (order is important).

I though subscription.fail(event,PersistentSubscriptionNakEventAction.Stop,'Error in sub service') would be the right choice. But Events keep on bubbeling in and get acknowledged to the eventstore.

I tried all combinations of the PersistentSubscription Settings, but weven with a 1000 Events to catch up, the subscription iterates throuh all of them, no matter how often I call sub.fail... Did I misunderstood the concept ? Any clarification is appreciated.

quorak avatar Mar 15 '19 10:03 quorak

Did you disable autoAck on the persistent subscription? By default persistent subscription are automatically acknowledge, so that would explain the behavior. Use false as the last parameters in connectToPersistentSubscription(stream, groupName, eventAppeared, subscriptionDropped, userCredentials, bufferSize, autoAck)

nicdex avatar Mar 16 '19 18:03 nicdex

EventStore will essentially just record that an event was not acknowledged. You can then use the Replayed Parked Messages in the admin ui to stream those events back to the subscription?

morrislaptop avatar Mar 21 '19 12:03 morrislaptop

hey there, thanks for the replay.

Yes i disabled autoAck. I want to have more control over the acknowledgement.

  • I would also like to park some of the unprocessable entities at time.
  • And in certain situations I want to Stop the incoming messages in a controlled manner (e.g. a subsequent service is unreachable) and continue at a later point

Isn't this what PersistentSubscriptionNakEventAction.Stop was thought for, or am i mistaken.

thanks a lot.

quorak avatar Apr 06 '19 06:04 quorak

Hello, we also struggling to understand concept behind PersistentSubscriptionNakEventAction.Stop. We also as this original problem describes, would like to stop subscription if certain events cannot be processed. Any suggestions here?

tombako avatar Dec 07 '22 07:12 tombako