Distributed Transactions Made Easy

Distributed Transactions Made Easy

Disclaimer This article contains a snippet from my booklet: Distributed Transactions Made Easy In the world of microservices and globally distributed applications, we can find ourselves quite often in charge of juggling complex operations that span multiple services. Imagine a multi-platform booking system, or even a “simple” e-commerce, with its...

2 minute read
EvenireDB part 1: what and why?

EvenireDB part 1: what and why?

I have quite a fascination for Event Sourcing. Not sure why this pattern got my attention a while ago, but since then I’ve been using it at work (whenever possible and meaningful) and for some personal projects too. I have also been blogging about it for some time, as some...

2 minute read
Thread-safety on MemoryCache

Thread-safety on MemoryCache

I have been using the in-memory cache library in a pet project lately and I stumbled on an interesting problem. Are we 100% sure that this class is completely thread safe? Let me clarify a bit. Most of the times, we use a cache as first layer before turning to...

2 minute read
Handling long-running operations in a .NET Background Service

Handling long-running operations in a .NET Background Service

I have seen few articles around about how to execute long-running tasks in a BackgroundService and most of them do the same mistake. The code looks more or less like this: public class MyWorker : BackgroundService { protected override async Task ExecuteAsync(CancellationToken cancellationToken) { while(!cancellationToken.IsCancellationRequested) { await DoSomethingAsync(); } }...

2 minute read