Notes based on playing and researching the Event Sourcing & Command Sourcing. This is closely related to microservices if applied properly. Event sourcing and command sourcing Overview Good segregation of application logic in terms of data modification and querying This should simplify reasoning about the application logic Since all modifications are just a stream of events it avoids side-effects people tend to put into read logic Also allows to have optimal models for each of above Improved scalability - write part is append-only so it reduces locking complexity If read model is updated asynchronously then not very well suited for complex screens where user can edit many fields and assumes upon save to get refreshed data Well suited for task oriented UI Commands - requested actions to be performed on the model, should be named as verbs Commands are immutable - they live just for short time of transfer from caller to command handler Events - performed model state changes, should use past tense (something happened and it cannot be undone) Events are immutable - past cannot be changed Stored in a sequential log which can be later used for analysis of what happened in the system Can be used later to update for example querying model Fixing a state change should be done by adding another event which reverts the previous operation Dealing with concurrency Pretty simple: Event can contain ‘version’ of model which is being updated Event log then can have a unique constraint for each aggregate id and model version Assuming two or more concurrent actions updated the same aggregate on same version one of the updates will fail Command handler then can decide: Retry the same operation with some merge logic Fail the operation This constraint can be implemented in relation database as well as other services (like Google Firebase).

Read more →

Setting up a cloud builder task to commit back to a Github repository using Deploy keys. Intro Sometimes it is useful to be able perform write operations in github repositories (or access a private repository etc.) This requires setting up an account with permissions An alternative would be setting up a cloud builder with SSH key which will be authorized to access the repository Cloud builder task below generates an RSA key which will be part of the task and can be allowed to access repository

Read more →

Experience with setting up first cloud build for .NET Core & Angular. Intro Read manuals carefully - you can test your build locally using Google Cloud SDK but it doesn’t work on Windows. So if you want to give it a try setup a Linux machine for it. I strongly recommend to setup Google Cloud SDK on your Linux machine manually and not thru a package manager - this may save you a lot of time since gcloud components install will work for you and thus examples can be followed easily.

Read more →

Pár poznámek k cyklosezoně 2018 - jen osobní poznámky… Jídlo a pití Co nefungovalo Sladké Jakékoliv větší množství cukru mě vždycky poslalo do kolen cca na hodinu možná déle (Seč na jaře, sám kolem Sázavy, Jeseníky s Pavlem). Sladké je v pohodě, ale je potřeba to občas proložit něčím normálním - bageta, chleba s sebou apod. Tohle zahrnuje i cyklotyčky, ionťák - lepší malá láhav ionťáku a velká čisté vody.

Read more →

Introduction Each project using database access solves how to distribute database schema and how to keep it up-to-date after upgrades. I was solving this problem multiple times, so I decided to write a common, easy to use, and freely available library. The result of this is the DbKeeperNet library which is pure ADO.NET framework (no dependency on Entity Framework). This article will briefly show how to use DbKeeperNet library to fulfill this task.

Read more →