At Evooq, we have been working on a life-cycle management platform (LCM) for structured products. Investors can have thousands of structured products in their portfolio (both present and past), and through LCM, we strive to offer them a transparent view of all their products’ current performances.

The price of structured products, like many other investment instruments, is susceptible to market change. Thus, it is vital for investors to monitor their products’ prices and get notified when the price goes above or below a particular value as well as when the daily fluctuation is greater than a threshold. …


In the last part, I have briefly introduced the concept of contract testing and why we need it. This article will look into how we can use the Spring Cloud Contract to enforce contract testing between Spring-boot microservice apps.

If you want to quickly dive into the code, feel free to check out the example source code in Github: https://github.com/alexthered/spring-boot-contract-testing-demo.

In this example, we will implement two services: producer (where the API is implemented) and consumer (where the API is consumed). The goal is to enforce a fixed, well-defined contract between the producer and the consumer. …


This is the first part of the series about contract testing for Spring-boot microservices apps.

Part 1: Introduction to Contract Testing

Part 2: Spring Cloud Contract Testing framework

Part 3: Contract Testing with Pact

Part 4: Contract Testing for GraphQl

Photo by Sebastian Herrmann on Unsplash

What is contract testing?

Contract testing is a set of automated tests that verify the interaction between two services (either through REST API or asynchronous message systems). It is different from unit and integration tests (which verify the operation within one service) and end-to-end test (which aims to validate the operation across UI and possibly multiple internal services).

For the…


This article discusses few best practices that we have used with our RabbitMq cluster hosted with GCP's Kubernetes application. Note that every configuration comes with a certain trade-off. It might work for us but not necessarily for your different requirement and workload.

Photo by T S on Unsplash

Set lazy mode for queues

With this mode it basically means that the messages delivered through RabbitMq are persisted to disk, instead of being kept in memory. This comes at a cost of higher latency in our case, however it brings much more stability for us.

This setting helps us to avoid the case when suddenly the number…


Photo by Tim Mossholder on Unsplash

Error handling is a very important part of a reliable and user-friend API. If you think of your API as a product, when something goes wrong with the product, it should clearly indicate the error to users and the reason why. Also, it should be able to guide users to avoid that error from happening again.

For example, if you have an endpoint to create a user: [POST] /v1/users, which expects a valid email and a min-6 letters password and when user sends a too short password, server should returns a 400 Bad request with the body including a translated…


Photo by True Agency on Unsplash

In a world of monolithic architecture, it's very common that backend application does not just receive and respond to API request, but also perform scheduling job such as data cleaning, notification sending…

In addition, the same app can also take the job from the queue and execute it. This architecture has tremendous advantage at the beginning as a team can re-use exactly the same code base and infrastructure and can quickly add a new scheduled job.

For example, to have a daily job of clearing expired token at 2am, in Spring Boot you can do this:

This works fine…


Photo by Michał Parzuchowski on Unsplash

Distributed job queue is a very popular pattern to process heavy batch work, which can require much 'bigger' (read: expensive) hardware resource to complete.

Let's illustrate with an example. Your system needs to send a newsletter to all of your users (e.g 100k users) on weekly basis. Since it is more important that all users receive an email, rather than they need to receive it at the same time, or exactly at a moment, it's probably useful to split the task into, for example, 100 tasks of sending email (each for 1000 users).

Why this approach is better? Sending to…


Recently, I ran into a situation where I wanted to customize the Json serialization of a list in an API response.

TL/DR: you can find the full source code on my github: https://github.com/alexthered/spring-jackson-custom-list-serializer

Concretely, I have a list of language strings:

public class LanguageString {

Locale locale;
String value;
}

and it should be serialized to: (a map-like format instead of a Json list)

{
"de": "hallo",
"en": "hello",
"fr": "bonjour"
}

To change the default json serialization with Jackson, you can implement a custom serializer and then you can either:

  • Annotate every field that you want to use that…


Recently, I have read an article of a Western expat living in my hometown Hanoi where he claimed that he is living a little life. That term rang a bell for me, probably I am living a similarly little life here far way from Vietnam.

So what is a little life?

A little life is a life with less or almost no drama. No fancy exotic Instagram with length list of catchy hashtags. Your Facebook update is not so often to be seen and with only few likes and comments. You’re not a popular guy in town either.

Most days…


Probably people do not go to gym to contemplate. Neither do I, I go to gym to work out, get myself recharged and wake my muscle up after hours of sitting rather static in front of the computer.

But that does not stop me from thinking and observing. There is actually so many life lessons that you can see at a gym.

If life and workout were a running race, it must be marathon, not sprint

You do not get your dreamy 6-pack abs after 1 damn heavy workout session. Maybe even not after 10 or 100 sessions. It can take months to get your body shredded.

So persistence is the key. It’s not…

Hiep Doan

Product engineer / novice writer (alexthered.me)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store