This is a guest post - Steven Blair is a Software Architect at VME Retail Ltd.
We have released version 1.0.0 of the Subscription Service, which is intended to make life that little bit easier for delivering events from EventStoreDB to clients.
The Subscription Service has been used privately by VME Retail Ltd for a few years in various solutions, and we decided to open the code up to the rest of the Event Store community.
What does the Subscription Service do?
The Subscription Service is a light weight library intended to simplify creating and delivering events from EventStoreDB to various endpoints.
For example, if you have a requirement to deliver all events from a category to a third-party client, you could do this:
List<Subscription> subscriptions = new List<Subscription>(); subscriptions.Add(Subscription.Create("$ce-Accounts", "Read Model", new Uri("http://externalclient.com/api/events"))); SubscriptionService subscriptionService = new SubscriptionService(subscriptions, eventStoreConnection); await subscriptionService.Start(CancellationToken.None);
The Subscription Service will connect (and create where applicable) the persistent subscription, and deliver all the events on this stream to the configured endpoint.
Business case for the subscription service
If Event Store is central to your system, there is a good chance you have a requirement to deliver events from here to other systems.
Examples of this might be:
- Read model
- Other bounded contexts (for eventual consistency)
- External systems out of your control
The Subscription Service sits in between your EventStoreDB and endpoints, and manages the delivery of these events.
This allows you to create routes for each stream (along with various configuration values).
One scenario we use at VME Retail is having a Subscription Service configured to deliver events to external systems. This means we can turn off delivery of these events by stopping the service, while continuing to consume events from other Subscription Services.
For anyone interested in the technical details of the Subscription Service, here is a quick overview:
- Service will create the persistent subscription if it doesn’t already exist
- Service will manage acking / naking of posted events.
- User can easily override default http settings to customise posting (for example, if you need to include an authorisation token in your POST)
The source code for the subscription service can be found on GitHub.
The package can be found on Nuget.