cody-greene / node-rabbitmq-client

RabbitMQ (0-9-1) client library with auto-reconnect & zero dependencies
MIT License
130 stars 9 forks source link

fix: check frame size before socket write #41

Closed cody-greene closed 9 months ago

cody-greene commented 9 months ago

Checking for oversized frames, client-side, prevents a connection-level error. This applies to any method that allows large strings or tables, like queueBind, queueDeclare, etc. Since this error is contained to the originating channel, other publishers/consumers on different channels will remain alive.

const pub = rabbit.createPublisher({confirm: true})
const bigstring = 'x'.repeat(4100)

// Uncaught AMQPChannelError: frame size of 4153 bytes exceeds maximum of 4096
await pub.send({routingKey: 'foo', headers: {bigstring}}, 'oops')