Using WireMock for dotnet core Integration tests

WireMock for dotnet core Integration tests

In many cases, to optimize or improve the system solution, the business decides to integrate with external systems. External systems have their life cycle, state, and communication protocol. There are different types of communication protocols, in this article, we will only consider HTTP. Microservices also use synchronous HTTP calls for notification or to achieve strong consistency.

You definitely want your integration to have fewer problems and be able to diagnose them easily. In order to implement reliable communication between the internal solution and the external system, it is necessary to cover the communication protocol with reliable integration tests.

Long-running tasks in Orleans dotnet

Orleans long-running task

Orleans is aktor model framework for building concurrent and scalable distributed applications. Grains (aka aktors) communicate with each other via messages. And it’s quite important to process a message within certain ResponseTimeout. If a message is not processed within timeout, Orleans throws timeout exception.

But what if grain needs to perform long-running tasks that can’t be complete within a defined timeframe? Let’s dive into the solution approach.

Control docker-compose startup flow with readiness probe

control docker-compose startup

Docker-compose is a powerful tool to run an isolated environment for the application. However, it doesn’t provide one important feature right out of the box which is startup control.

  • What if the containerized application requires a database to be up and ready and fully provisioned?
  • How to check if a certain process is finished in another container?

If you encounter such issues lets dive into the solution.

Dotnet Database Repository With Cache

Repository with cache

This article describes the approach of implementing the cached repository with the following scenario:

  • Repository provides simple operating for storing and reading phone numbers in the MS SQL database;

  • Support the atomicity of multiple updates and insert operations. Possibility to wrap batch upsert operations into the transaction via TransactionScope;

  • On read and write store phone numbers in memory cache. On read return most recent phone number from cache, hence, reduce the amount of database read operations;

  • In memory cache should implement the same repository interface as MSSQL repository. Thereby, MSSQL repository can be easily replaced with in-memory cached repository;