Select Page
“Event sourcing” a briljant way to “go back to the future”

“Event sourcing” a briljant way to “go back to the future”

What is event sourcing?

Instead of storing just the current state of the data in a domain, use an append-only store to record the full series of actions taken on that data. The store acts as the system of record and can be used to materialize the domain objects. This can simplify tasks in complex domains, by avoiding the need to synchronize the data model and the business domain, while improving performance, scalability, and responsiveness. It can also give consistency for transactional data, and support full audit trails and history that can enable compensating actions. “Source: Microsoft docs”

Difficult words, isn’t it ? So how do i understand that as a junior. Event sourcing is recording the state from an object, the state in the universe as u can understand. So what can you do with that recording, its like what happened is happened, it’s recorded and can be found back in the history. A blockchain in cryptocurrency is an example ( Read my next post about cryptocurrency). Actually every accountancy is an example, also a shopingcart (digital) like showed in the image bellow.

u see what happened? I’ll explain, if you have a shopping cart see it as a stream. So we are gonna add some events on the stream. Like “Added 2 socks” this is an event that will be added to the stream. On that stream u will have consumers, consumers that are gonna read every event on the stream. If the event does have an effect on his job or task, then it will trigger a handler. Like the stock manager knows now that there are going to be 2 socks sold. Idem about the next event that has “Added 4 shirts” now he know’s that there are 4 shirts to be sold. The next event will remove 2 socks that you added earlier, you don’t delete the event cause the event has happened. You just counter it, the next event is “shipping information added” here will the shipping manager know where to send the bought stuff to. Like i told earlier is that you will have consumers. Let’s talk a bit more about that.

Consumers are reading the stream. What can an example be like here above u have like the stock manager and the shipping manager. Every consumer has a handler on a specific event. Like the stock manager only want’s to know what happens with his stock and he doesn’t care about the “shipping info”, the shipping manager doesn’t care what the customer does with the cart but he wants to know where to send it to and what to send.

Lets use an example in coding. So you make a producer and a consumer, the producer will add events on an eventstream and a consumer will read it. Don’t you get it ? Let me show it.

As you can see there are consumers and producers. What i didn’t add to this picture is the possibility that a consumer also can be a producer. Cause everyone that want’s to write an event on the stream can do that as a producer.

event sourcing is mostly used in CQRS desing pattern.

Why can it be handy?

Let’s take the shopping cart example back. If a costumer leaves his shopping cart but did not finish it. You can recover he’s cart the next moment that he visits the shop again. Another example if you work in an accountancy you can follow perfectly what happened and react to any mistakes that his happened along the stream. Another example, what if your database drops or you make a huge mistake and your back-ups are gone? Then can event sourcing be your solution, cause u can replay every message on your streams from the begin of the stream to the end of your stream and it will trigger all your actions again, so it will rebuild your database again. You can debug in time, you even can go back in time of the event stream of course. You can query over time and see events or replaying them, it can make you a time manager.

Why can it be a pain in the ass ?

It’s not easy to implement and control, you need to change your mind of thinking to the right solution. You don’t have 1 big flow. consistency is hard to hold.

 

What are great event sourcing tools?

eventstore

Apache Kafka

event hubs

AggregateSource (on github)

 

 

 

Started a project

Started a project

A colleague of my started a project with a mate, it’s about a trading bot for bitcoins. simple intelligence behind for the sharing, Buy when low Sell when High. I also wanna work on it and did some changes in it, wanna make nice interface en more choices for using all the currency’s So i make this project open-source just to make it better and smarter, feel free to join in. The github repository is : https://github.com/homeforce/BitstampTrader Any Questions ? just ask.

a starting sample app

a starting sample app

So after a few introduction posts its time for me to trying to put here some real work.
So to my opinion is it very handy to make yourself a starting template where you launch every app from.

I hear you think… Why in the “damn god” would i do that? Simple if you make a few apps and use the same language gonna take for example Angular 2,
and you start from a sample app or starting template. Then it is time-saving, cause after all there are some generic components that you use every time like:

  • home Component
  • navigation
  • loadingscreen
  • footer
  • CRUD services
  • base css -> bootstrap
  • some handy npm packages
  •  …

so actually the only stuff you need to do then is

  •  npm install
  •  change the app name

and there you go !! A fresh app to create and you saved in the beginning of you programming career a lot of time. Even later it is.
so if you think about it? You’ll see that it is very handy to use those starting things. But hey its still my opinion of course.

Who is this papercut survivor?

Who is this papercut survivor?

So who the hell is this guy? Simply I am Tyas Lambrechts, a guy from Belgium that was born in 1995.

Started at school as welder and did go to college Karel de-Grote for 2.5 years as student in Multimedia Technology.

I learned some awesome stuff from LED to making games and 3D models. After those years i just didn’t pass trough my math and quitted college.

As far as i am, i got an opportunity to start join a .NET Boot camp by the company Team4Talent and now i am where i am. It is my passion to find in today’s technology the way to make it technology of yesterday. I stand with pride right than a modest man. In my work I am dedicated, accurate, analytical, disciplined and inventive. Some of my positive attributes by the voice of people around are : passionate, inquisitive, humoristic, social, proud and responsible. You can count on me! I like team work, friendship and a laugh. I always try to stay positive and that to move up to those around me. In my spare time I’m both dj as gamer. I like to be behind the turntables and do a lot of sports. also I like to explore the world, network and spend a lot of time to friends.

   76561197988696644

Here is where i start

Here is where i start

Hey, my name is Tyas Lambrechts.
I’m a junior .NET developer, with a big passion for developing and exploring new technology’s.
I was considering to start a blog, so I just did it. Not really in my comfort zone but Hey life challenges you outside your comfort zone.
What are you going to read on this blog? I am trying to tell you guys my story how I got here and how I am growing.
I will write some great and awesome grammar mistakes, cause I learned my languages on my self. Sorry for that.
This is my first post and will start here. But in the following days I will write new posts and try to share this blog to the open world.
I hope you would help me to reach a lot of viewers and let them feel what I feel and reach together what we are fighting for.
So for now goodnight and see ya.