Guest post: Subscription service for EventStoreDB

Articles
,

This is a guest post - Steven Blair is a Software Architect at VME Retail Ltd.

Introduction

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.

Subscription Service for EventStoreDB

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:

  1. Read model
  2. Other bounded contexts (for eventual consistency)
  3. 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.

Technical details

For anyone interested in the technical details of the Subscription Service, here is a quick overview:

  1. Service will create the persistent subscription if it doesn’t already exist
  2. Service will manage acking / naking of posted events.
  3. User can easily override default http settings to customise posting (for example, if you need to include an authorisation token in your POST)

Additional information

The source code for the subscription service can be found on GitHub.

The package can be found on Nuget.


Related posts

The Road to Cloud: Part 1

Articles
Zachary Schneider,

We made it! Event Store Cloud is now in Early Access. In this post, we will share some information about what we have built and what decisions allowed us to execute at a rapid pace with a small team.


Server-Side Filtering

Articles
Mat McLoughlin,

In the latest version of EventStoreDB we brought out a new feature, server-side filtering. This feature allows you to pass a filter when querying EventStoreDB so that it will only return events that you asked for.