From the course: Node.js: Microservices

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Consuming orders

Consuming orders

- [Instructor] We have now orders waiting in our queue. Now we have to create the logic in the order service to consume these messages and create orders from it. For that, I will now open workspace microservices. I open the order service, and I also head to the order service console. And I stop the script real quick because I have to npm install dash s amqplib, because obviously we need to store as well. And, I'm starting the script again. And now the question is where should this logic live? And it can basically live anywhere. I will now add it to my app.js script. So somewhere down there before the module gets exported I will simply add this logic now, because it's independent of any route. And now I will use something a little bit specific to nodejs, so I will create an async function that calls itself so that I can use async await within this function. So I start with async, then parenthesis, then I prepare the…

Contents