Event Store blog - page 10

Updated repository sample code

News
,

As you may be aware, we’re removing the $streamCreated event which currently appears in all streams in favour of a metadata stream. This is currently done on the development branch, and can affect how you compute expected versions for streams. I’ve updated the sample code for the CommonDomain repository previously shown in the getting started series on the WithoutStreamCreated branch. https://github.com/EventStore/getting-started-with-event-store/tree/WithoutStreamCreated Specifically note the changes in the save method and in the get specific version...


Projections 8: internal indexing

Tutorials
,

In the last post we introduced the new concept of fromStreams([]) that will join multiple streams into a single stream for your fold to be run against. We also introduced options and two options that can be used to control the re-ordering behaviour in a distributed environment. In this post we are going to look at how this concept is used internally in the Event Store in order to provide indexing of queries. Let’s propose...


Projections 7: Multiple Streams

Tutorials
,

Up until this point we have only used two event selection methods for our projections. We have used fromStream(‘stream’) which will select all of the events in a stream and we have used fromAll() which selects all events in the system. There is another quite useful selection that will move us from SEP (Simple Event Processing) to CEP (Complex Event Processing). This is the ability to select between multiple streams. To select from multiple streams...


Ensuring writes – multi-node replication

Articles
,

We have gotten the question very often how the multi-node version works with replication. After typing it up about five times in email I figured it might be valuable to do a longer write-up that we can suck into our documentation (and a blog post). One could quite easily put the Event Store Open Source version running on a virtual machine with data storage on a SAN. If the first machine goes wrong for some...


Projections 6: An indexing use case

Tutorials
,

As we went through in Projections 5 : Indexing, the linkTo() function is capable of emitting pointers to another stream. This can allow you to break apart streams in order to change their partitioning and to allow fast indexing. In this post we will look at a use case of how you can use this functionality. I have seen no less than 10 custom auditing systems for nservicebus. Everyone seems to want to build out...


Projections vs RxJS vs etc

Articles
,

There was a pretty good question this morning when I checked comments on posts. “What is the difference between projections and, say, rxjs?” We could as easily include any of the functional reactive libraries out there (bacon.js, flapjax, elm, Rx, etc). We can also start going way back and looking at predecessors like CLM. Let’s start with the similarities both are JavaScript. Both are functional reactive APIs (this is why they look rather similar). They...


Projections 5: Indexing

Tutorials
,

Now we can start getting to some of the interesting things in Projections. It was quite odd, as I was leading up to this post last night we got into a very long discussion about indexing inside the Event Store on twitter. Mike Brown noted that it would be really useful if we built lucene like indexing into the system so he could use the Event Store as an Audit Log that was easily searchable...


Projections 4: Event matching

Tutorials
,

In the “intermission” post we jumped ahead quite a bit in terms of the complexity of the projection we were building. Let’s jump back into our progression of learning bits. The projections we have used so far have used a method called when(). This method allows you to match functions back to types of events. Up until now that has been a single match but you can also use more than one. fromStream('test').when({ Event1: f1,...


Projections (intermission)

Tutorials
,

Yesterday I was meeting with a company. We were going through some of their problems and looking at whether the Event Store and in particular stream querying might be a viable solution to any of their problems. It turned out one of the problems was a perfect example of where projections can make a big project tiny. The Problem People put “Bid Strategies” in through a web application. These strategies are then used for blind...


Projections 3: Using state

Tutorials
,

In Projections 2 we looked at creating a very simple projection that would analyze our statistics inside of the Event Store. The projection was: fromStream('$stats-127.0.0.1:2113'). when({ "$statsCollected" : function(s,e) { var currentCpu = e.body["sys-cpu"]; if(currentCpu > 40) { emit("heavycpu", "heavyCpuFound", {"level" : currentCpu}) } } }); This is a very common type of scenario we will find in event based systems. We can describe this as: “When this event happens and this information is on...