简体   繁体   中英

Cloud9 AMQP: Node JS - Channel not being created

Followed this tutorial: http://www.rabbitmq.com/tutorials/tutorial-one-javascript.html

Developing in cloud9 right now and just trying to get the send.js and receive.js to work. But the channels aren't seeming created when I run the file. I first try to run send.js by executing node send.js and then execute node receive.js in another terminal. However, it never seems to connect or create the channel as it doesn't work as the tutorial suggests it should and no log statements within the amqp.connect() method are displayed.

Any guidance on what I'm doing wrong? Is there a suggested way to debug to see what's going?

Please see:

https://github.com/hhprogram/ProjectSite/blob/master/receive.js

and

https://github.com/hhprogram/ProjectSite/blob/master/send.js

Note: I also tried to follow this post ( https://medium.com/@HolmesLaurence/integrating-node-and-python-6b8454bfc272 ) but got the same bug where the channel was never being created when trying to coordinate between node and Python.


The ultimate goal is to have amqp set up such that I can take input from a webpage, have that handled by nodeJS and then sent to a queue to be consumed by a Python script. Then the Python script does some calculations and returns its results to another queue.

In the function:

amqp.connect('amqp://webdev-bootcamp-hhprogram.c9users.io/', function(err, conn)

You are not specifing an user and password so by default it tries guest@guest .

The guest user is usually only allowed to access the RabbitMQ server from localhost. If you are accesing from another machine (as I suppose seeing the URL you are using), make sure to use an user and password that exists in the server or give permissions to the guest user to access from a remote machine.

More info here:

http://www.squaremobius.net/amqp.node/channel_api.html#api_reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM