Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.

Catch Up Subscriptions
As mentioned, I previously would use catch-up subscriptions for various use cases. One of them would be for sending emails on specific events occurring in the system. A worker process would subscribe to the $all event stream and handle incoming messages accordingly. The issue is that catch up subscriptions are controlled by the client. The start position of the subscription is stored by the client. This information must be maintained by the client. This means I did not have a built-in way to have multiple worker processes handle events from the same stream but only processing each event only once. Notice I wrote built-in above. Yes I could of created shared datasource that each worker process would share in order to determine which messages where being handled by which process. I didn’t want to go down this road. The next option would be to have multiple worker processes but each worker process would only be handling a single or small subset of events.Persistent Subscriptions

Groups
When you create a persistent subscription, you will define a group name and the event stream you want to subscribe to. When your client (consumers) want to use this subscription, they specify the same group name and the stream.Acknowledge/Not Acknowledge/Timeout
I’ve rewritten the above thanks to Greg Young’s correction in the comments.
The server will dispatch N events to the consumer at any given time. The number of events is configurable when connecting to the subscription as you can define a buffer size which is the number of in-flight messages the client is allowed. It can also not acknowledge the message, or if a timeout period expires without either a retry can occur.
One slight correction:
“The server will dispatch only one event to a consumer at any given time. The event at this point is marked as in-process. The client will acknowledge it has processed the message. It can also not acknowledge the message, or if a timeout period expires without either a retry can occur.”
There are N messages at any given time (configurable) this is crucial for performance (otherwise you pick up the latency of the send->ack per message. Also don’t need to synchronously ack/nak you can example push them to async operations and ack/nak on completion.
Thanks Greg, appreciate the correction. I’ve rewrote that section to clarify.
:+1:
Also interested in the quirks in the API, maybe we can fix some of them!
Well it’s no so much the API per say, more to do with debugging in VS and message timeout.
Pingback: Event Store Persistent Subscriptions Demo - CodeOpinion