Our first application that we built in this chapter is very simple. It had one queue, where the publisher did not care what happened to the job and the worker did not have to let the publisher know the job was done. We will cover one more example of message queues. We are now going to create an application where the publisher needs to know when the worker is done. A great example of this is charging a credit card. We are not going to build out an entire charging application, but we will mimic one. Let's build it! Create another folder named rabbit_second
, and create a package.json
file with the following code (remember to run npm install
in order to get all the packages):
{ "dependencies": { "amqp": "0.2.0", "socket.io": "1.0.6" } }
We are going to use Express to give us easy static file serving, and routing, and Socket.IO for the real-time charging of credit cards (we will build the structure, but we will not actually charge any cards). We can now create...