Book Image

Building Scalable Apps with Redis and Node.js

By : Joshua Johanan
Book Image

Building Scalable Apps with Redis and Node.js

By: Joshua Johanan

Overview of this book

Table of Contents (17 chapters)
Building Scalable Apps with Redis and Node.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding message queues to PacktChat


We can now add message queues to the application we are building. Our application does not need credit card processing or transaction e-mails, but we will add logging through RabbitMQ. We will create a logging exchange and two queues, debug.log and error.log. The debug.log queue will log everything that comes through the exchange (including errors), and error.log will only log errors. We will do this by using a topic exchange.

Topic exchange

Our test applications have used a direct exchange. What this means is that the queue must use the same exact routing key that the message was published with. Topic exchanges allow pattern matching in the routing key. In our example, we will bind the debug.log queue with a routing key of *.log. This will match any messages that are debug.log or error.log. The error.log queue will bind using error.log, so it will work exactly like a direct exchange. The exchange will put an error.log message in both the error and debug...