1

I'm trying to connect to a rabbitmq service with nodejs (just trying to implement the connection before publishing / subscribing).

I saw many connection examples, none of them worked to me this is the code I've been using.

exports.connectQueue = () => {
  // Step 1: Create Connection
  amqp.connect(
    {
      protocol: "amqp",
      username: "username",
      password: "password",
      hostname:"aws host address",
      port: 5671(default),
      vhost: "/",
      heartbeat: 0,
    },
    (connError, connection) => {
      if (connError) {
        console.log("connError is this - ", connError);
        throw connError;
      }
      console.log("connected");
    }
  );
};

When I try to connect I get this error -

OperationalError: read ECONNRESET

 isOperational: true,
 errno: -4077,
 code: 'ECONNRESET',
 syscall: 'read'

I got a python server which also does the same - but I do manage to create connection to the same rabbitmq instance, with the same credentials (I also manage to publish a message and consume it). At this point I don't know what I'm doing wrong, tried every example I saw and nothing worked. The libraries I tried to use are -

"amqplib/callback_api"
and
"amqplib"

Both did not work.

Àtishking
  • 263
  • 1
  • 4
  • 15

0 Answers0