Previously, the file where the communication layer of our News microservices was located was called views.py. However, the HTTP communication layer does not exist in our application and, consequently, the views.py file doesn't either. Instead, we have a new file called services.py, which is responsible for establishing communication with the message broker. The service.py file is exactly where we will declare the CommandStack and QueryStack.
As always, we will first declare our dependencies. In this part of the following piece of code, we will declare our models and everything necessary for the use of Nameko:
import mongoengine from models import ( CommandNewsModel, Base, QueryNewsModel, ) from sqlalchemy import Sequence ...