noodlefrenzy / node-amqp10

amqp10 is a promise-based, AMQP 1.0 compliant node.js client
MIT License
134 stars 56 forks source link

Problem with Reconnect #341

Closed philib closed 3 years ago

philib commented 6 years ago

Hi,

i'm using node-amqp10 with ActiveMQ. First i had a problem with establishing a connection to the broker:

C:\Users\psr\Desktop\Workspace\frontend\node_modules\amqp10\lib\frames.js:64
  stream.write(buffer, callback);
        ^

TypeError: Cannot read property 'write' of null
    at Object.frames.writeFrame (C:\Users\psr\Desktop\Workspace\frontend\node_modules\amqp10\lib\frames.js:64:9)
    at Connection.sendFrame (C:\Users\psr\Desktop\Workspace\frontend\node_modules\amqp10\lib\connection.js:329:10)
    at Connection._sendCloseFrame (C:\Users\psr\Desktop\Workspace\frontend\node_modules\amqp10\lib\connection.js:491:8)
    at Connection._receiveAny (C:\Users\psr\Desktop\Workspace\frontend\node_modules\amqp10\lib\connection.js:413:12)
    at Connection._receiveData (C:\Users\psr\Desktop\Workspace\frontend\node_modules\amqp10\lib\connection.js:358:8)
    at NetTransport.<anonymous> (C:\Users\psr\Desktop\Workspace\frontend\node_modules\amqp10\lib\connection.js:516:38)
    at emitOne (events.js:96:13)
    at NetTransport.emit (events.js:188:7)
    at Socket.<anonymous> (C:\Users\psr\Desktop\Workspace\frontend\node_modules\amqp10\lib\transport\net_transport.js:26:49)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:547:20)

I was able to solve that using the anonymous sasl mechanism:

var connection = client.connect('amqp://localhost', {'saslMechanism':'ANONYMOUS'})

But now there is another problem: If the client successfully established a connection with the broker and afterwards the broker disconnects, the client tries to reconnect to the broker. But if the broker is back up, the same error appears again. Is it possible that the client tries to reconnect without the previously configured sasl mechanism?

shako92 commented 6 years ago

I have the same problem, it never reconnects

JerryLeeCS commented 4 years ago

is this still a problem?