Let's have a look at the following steps:
- 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 ...