Creating asynchronous send-receive communication
Spring Boot 2.0 directly supports the asynchronous handling of send and receive messages with asynchronous results. Some microservices purposely implement this kind of exchange mechanism to avoid traffic and blocking problems when several of them send request messages at the same time to an exchange with one routing key. Moreover, this solution is most likely favored due to the presence of client-based callbacks that give microservices resiliency when the consumer
is down or has crashed.
Getting started
Again, open ch11-ipc-emp
and ch11-ipc-login
, and add the following request
and reply
queues, @RabbitListener
response transactions, and client services that will showcase the use of AsyncRabbitTemplate
.
How to do it...
Let's build non-blocking and message-driven services using the following steps:
- Let's first modify
consumer
of the message or the source of the response transaction, which is the Login Microservice. Add a@Configuration
class that...