Guest post: Subscription service for Event Store

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 Event Store 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 Event Store

What does the Subscription Service do?

The Subscription Service is a light weight library intended to simplify creating and delivering events from Event Store 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 Event Store 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

Case Study: How Event Sourcing is Spurring Linedata’s Digital Transformation

Articles
,

Event sourcing is relatively new to the financial services industry. By implementing Event Store’s approach to support its digital transformation strategy, Linedata can be more responsive to the changing needs of its customers and gain a competitive edge in the market. “The core benefits of event-driven architecture allowed us to improve quality, performance and respond quickly to our customers,” said Adrian Tovey, who leads Linedata’s global program management. “Event Store has helped us meet the demand for change in the industry, a change in the way applications are used to deliver services to our customers; Linedata is at the forefront of those changes.”


Disabling disk caching in Ubuntu

Articles
,

Amongst the many interesting discussions I had at Build Stuff last week was about how it’s desirable to switch off disk caching for the disks used for Event Store databases to help ensure that data is durable in the face of power failures. This is actually true of many databases, indeed, postgres gives you a warning about the possible dire consequences of having write caching switched on when you may experience power failure. You can...


Testing Event Store HA

Articles
,

As we prepare to release Event Store 2.0.0 binaries (the source code was just merged to the master branch over on GitHub), we also will be opening up access to one of the test environments that we’ve been using for our commercial high availability clustered product, Event Store HA. We get many questions asking how the clustered version behaves during network partitions and server failures – now you can see for yourself! The cluster in...