Showing posts with label Event sourcing. Show all posts
Showing posts with label Event sourcing. Show all posts

Thursday, September 24, 2015

Another way to talk about CQRS/Event Sourcing

"A more promising model, used in some systems, is to think of a database as an always-growing collection of immutable facts. You can query it at some point in time — but that’s still old, imperative style thinking. A more fruitful approach is to take the streams of facts as they come in, and functionally process them in real-time."

Turning the database inside-out with Apache Samz
https://martin.kleppmann.com/2015/03/04/turning-the-database-inside-out.html

Monday, April 13, 2015

Architectures Comparison Summary



For Event-Driven architecture. there are two problems:
Testability and Development

But with CQRS/Event Sourcing, it is very easy to create BDD unit test.

Source:
http://www.oreilly.com/programming/free/files/software-architecture-patterns.pdf

Tuesday, March 10, 2015

Friday, March 6, 2015

What is category in Event Store?

 If put dash into stream name, the first part will be saved as category name

Source code from Event Store 

  _handler = new CategorizeEventsByStreamPath("-", Console.WriteLine);

        public override string GetCategoryByStreamId(string streamId)
        {
            string category = null;
            if (!streamId.StartsWith("$"))
            {
                var lastSeparatorPosition = streamId.IndexOf(_separator);
                if (lastSeparatorPosition > 0)
                    category = streamId.Substring(0, lastSeparatorPosition);
            }
            return category;

        }



http://codeofrob.com/entries/creating-a-projection-per-stream-in-the-eventstore.html

Friday, February 27, 2015

What is unit of work and relationship with CQRS/Event Sourcing?

See
http://martinfowler.com/eaaCatalog/unitOfWork.html



But I think this pattern is not applicable for CQRS/Event Sourcing, because SAGA is the way to deal with transaction in CQRS/Event Sourcing.
Reference:
https://msdn.microsoft.com/en-us/library/jj591569.aspx

Thursday, February 19, 2015

Wednesday, February 18, 2015

How to solve problem "Read access denied for stream" while reading events from event store?

Get this error on following line:
var event = connection.ReadStreamEventsForwardAsync(streamid, 0, 1, false).Result;

Need to add credential for reading
var event = connection.ReadStreamEventsForwardAsync(streamid, 0, 1, false,  new UserCredentials("admin", "changeit")).Result;

How to solve problem "System.AggregateException: One or more errors occured ---> EventStore.ClientAPI.Exceptions.RetriesLimitReachedException" when try to connect to write event to Event Store?

This error happened  after downloaded Event Store 3.0.1 and tried following code for the testing

            string serverIpaddress = "127.0.0.1";
            var connection = EventStoreConnection.Create(new IPEndPoint(IPAddress.Parse(serverIpaddress), 2113));
            connection.ConnectAsync().Wait();
            var myEvent = new EventData(Guid.NewGuid(), "testEvent", false,
                                        Encoding.UTF8.GetBytes("some data1"),
                                        Encoding.UTF8.GetBytes("some metadata"));
            connection.AppendToStreamAsync("test-stream",
                               ExpectedVersion.Any, myEvent).Wait();

On line of AppendToStreamAsync, exception throws:
 "System.AggregateException: One or more errors occured ---> EventStore.ClientAPI.Exceptions.RetriesLimitReachedException"

Cause: .NET API of Event Store goes by TCP port, which default value is 1113, http port number is 2113 by default.

Just change to            
          var connection = EventStoreConnection.Create(new IPEndPoint(IPAddress.Parse(serverIpaddress), 1113));

Reference
https://groups.google.com/forum/#!topic/event-store/5uWEqybibw8

Wednesday, February 11, 2015

What is projection in event sourcing

Projection is about deriving current state from the stream of events
Reference:
http://abdullin.com/post/event-sourcing-projections/

Tuesday, February 10, 2015

Reading about CQRS and event souring

Exploring CQRS and Event Sourcing
https://msdn.microsoft.com/en-us/library/jj554200.aspx

Applying CQRS and Event Sourcing in Microsoft .NET Applications TechEd Europe 2014
https://www.youtube.com/watch?v=z5FPkCgcH4M