Adding a get all messages RPC

In our MessageService class, simply add:

@rpc 
def get_all_messages(self): 
    messages = self.message_store.get_all_messages() 
    return messages 

I'm sure that by now, I probably do not need to explain what is going on here! We are simply calling the method we made earlier in our Redis dependency and returning the result.

Get Python Programming Blueprints 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.