The publish/subscribe messaging pattern
Redis also includes an implementation of the publish/subscribe messaging pattern. This section demonstrates how we can use Spring Data Redis for the purpose of sending and receiving messages. As an example, we will modify the CRUD application that stores the contact information as JSON to send notifications when a new contact is added, contact information is updated, and a contact is deleted.
We can implement this requirement by performing the following steps:
- Create message listeners that process the received messages.
- Configure the application context of our application.
- Send messages by using the
RedisTemplate
class.
This section also describes how we can ensure that our implementation is working correctly. ...
Get Spring Data now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.