connection error

434 views
Skip to first unread message

dhan

unread,
Dec 21, 2016, 9:50:07 AM12/21/16
to rabbitmq-users
Hi
I m getting some error while running rabbitMQ js files like conn.connection undefined.

It working fine in my system.it getting an issue ,please  do it need full

Michael Klishin

unread,
Dec 21, 2016, 10:09:43 AM12/21/16
to rabbitm...@googlegroups.com
We cannot suggest anything with the amount of information provided. Please post your code, server logs and the entire error message (or even better, a shell transcript).
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dhan

unread,
Dec 21, 2016, 10:40:34 AM12/21/16
to rabbitmq-users
> i'm a newbie to rabbitmq , so while following these tutorials  
> and i'm trying to execute the hello world i'm getting this error  
> ,
>  
> conn.createChannel(function(er
r, ch) {
> ^
> TypeError: Cannot read property 'createChannel' of undefined  
> (screen shot of the error attached)
>  
> was wondering if anyone could help me out and tell me where am i  
> going wrong ,

Michael Klishin

unread,
Dec 21, 2016, 10:43:26 AM12/21/16
to rabbitm...@googlegroups.com, dhan
The errors says that the `conn` variable is your code is undefined.
> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
> To post to this group, send an email to rabbitm...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Michael Klishin

unread,
Dec 21, 2016, 10:49:20 AM12/21/16
to rabbitm...@googlegroups.com, dhan
OK, I could reproduce it by running the example without having a node running.

All tutorials assume there’s a RabbitMQ node needs to be running on localhost with all defaults.
See “Prerequisites” on http://www.rabbitmq.com/tutorials/tutorial-one-javascript.html.

On 21 December 2016 at 18:40:38, dhan (johnsai...@kaaylabs.com) wrote:
> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
> To post to this group, send an email to rabbitm...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

dhan

unread,
Dec 21, 2016, 11:04:14 AM12/21/16
to rabbitmq-users, johnsai...@kaaylabs.com
var amqp = require('amqplib/callback_api');

amqp.connect('amqp://localhost', function(err, conn) {
conn.createChannel(function(err, ch) {
var q = 'hello';
var msg = 'Hello World!';

ch.assertQueue(q, {durable: false});
// Note: on Node 6 Buffer.from(msg) should be used
ch.sendToQueue(q, new Buffer(msg));
console.log(" [x] Sent %s", msg);
});
setTimeout(function() { conn.close(); process.exit(0) }, 500);
});





i am using this code .
Reply all
Reply to author
Forward
0 new messages