How it works...

Event handlers are the main players in this direct reply-to communication among microservices. This recipe uses Spring Data REST's @RepositoryEventHandler, registered as the @Service to the webflux container, which acts like a filter to its service methods. It has filter event methods registered as @HandlerAfterCreate that directly publish the request message with or without the payloads included.

Transactions involving event handlers are synchronous by default, but since they are used for AMQP-based communications, they adjust and comply with the asynchronous objectives of the protocol. At this point of this chapter, a loosely-coupled architecture has been established using only a few simple steps.

Get Spring 5.0 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.