Greg Young on using Event Store as a Read Model
Greg Young, the lead architect behind the Event Store, recently talked about the Projections Library in the Event Store and how it can be used as a Read Model. In his presentation Greg explained what the Projections Library is, together with its main use cases. He also presented a number of examples of practical use.
The Projections Library is a stream database focusing on temporal queries. A temporal query is used when you want to correlate things that happen in time, e.g. finding users on Twitter that said the word “presents” within one minute of saying the word “birthday”. According to Greg, temporal queries are a common type of queries in business systems, queries that Event Store solves easily. When solving the same kind of problems with SQL they often tend to be complex and grow exponentially with the number of sub queries needed.
Features in the Projections Library include:
- Taking an event stream and converting it to some other form, e.g. selecting name from a stream of new customer events.
- Partitioning of streams into new groupings (e.g. splitting or joining streams).
- Projections across multiple streams to make it possible to query large amounts of events (e.g. concurrently querying all bank accounts looking for specific transaction patterns).
- Continuous queries. Projections can be kept running and as new data comes in it also goes into the query result.
- Emit new events, e.g. looking for orders above a certain size and from these orders creating large order events for making an extra credit control.
The Projections Library is especially built for big data problems, continuous queries and streaming information.
Greg specifically notes that the Projections Library is not a replacement for NoSQL databases (e.g. a document database), that is far from its primary use cases.
The primary interface is AtomPub. Most platforms have the capability of sending HTTP requests and can therefore be used for building Event Store clients and also be part of a heterogeneous environment.
Event Store is a database built according to the concepts of an Event Source where events are stored, instead of current state as in most types of databases today. Event Store is an open source product, also available with commercial options. It was released in September 2012 during a launch event in London and version 1.0.1 has just been released.