How to do it...

Let's have a look at the following steps:

  1. We'll modify our message-service and add a new endpoint that allows us to query all messages for a particular user. This introduces the notion of an inbox, so we'll modify our MessageRepository class to add a new in-memory map of usernames to lists of messages, as shown in the following code. Note that in a production system, we'd choose a more durable and flexible store, but this will suffice for demonstration purposes:
package com.packtpub.microservices.ch08.message;import com.packtpub.microservices.ch08.message.exceptions.MessageNotFoundException;import com.packtpub.microservices.ch08.message.models.Message;import java.util.*;import java.util.concurrent.ConcurrentHashMap;public ...

Get Microservices Development Cookbook 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.