A
A
Andrey Rudakov2021-12-22 15:44:48
Node.js
Andrey Rudakov, 2021-12-22 15:44:48

How to avoid creating duplicates when querying RabbitMQ?

I have RabbitMQ sending requests to microservices (gateway).
For example, the registration microservice does not respond and the client sent 10 registration requests with the same EMail address. There is an EMail busy check, but the requests are fired asynchronously, and as a result, the check passes.
As soon as the microservice becomes available, RabbitMQ pushes these 10 requests, as a result, 10 duplicates are written to the database.
How to deal with it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2021-12-22
@DEMETRA-WORK

There is an EMail busy check, but the requests are fired asynchronously, and as a result, the check passes.

The answer suggests itself. Validation must be done at the record creation level.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question