Let's now create the RPC method that is going to call our new client method. In our MessageService, add the following method:
@rpc def save_message(self, message): message_id = self.message_store.save_message(message) return message_id
Nothing fancy here, but notice how easy it is becoming to add new functionality to our service. We are separating logic that belongs in the dependency from our entrypoints, and at the same time making our code reusable. If another RPC method we create in the future needs to save a message to Redis, we can easily do so without having to recreate the same code again.
Let's test this out by only using the nameko shell - remember to restart your Nameko service for changes to take effect! ...