amqp-client.js icon indicating copy to clipboard operation
amqp-client.js copied to clipboard

No longer possible to bind queues in parallel

Open jscheffner opened this issue 2 years ago • 6 comments

Hey, after updating to v3 this is no longer working

import { AMQPClient } from '@cloudamqp/amqp-client'

const amqp = new AMQPClient('amqp://localhost')
const conn = await amqp.connect()
const ch = await conn.channel()
const q = await ch.queue('test-queue')
await ch.exchangeDeclare('test-exchange', 'fanout')

console.log('A')

await Promise.all([
  q.bind('test-exchange', 'foo:*'),
  q.bind('test-exchange', 'bar:*'),
])

console.log('B')

A is still logged, B is not. The promise keeps pending when binding two routing keys at the same time. If run with v2 the Promise resolves and B is logged.

Binding sequentially works with both versions:

await q.bind('test-exchange', 'foo:*')
await q.bind('test-exchange', 'bar:*')

This is a bit unexpected and I didn't find anything in the changelog that suggests that this change was intended.

jscheffner avatar Oct 04 '23 12:10 jscheffner

It was probably not intended. Probably easy to find the commit that broke it using https://git-scm.com/docs/git-bisect

dentarg avatar Oct 04 '23 17:10 dentarg

That's a good idea, I'll try that.

jscheffner avatar Oct 04 '23 21:10 jscheffner

Looks like d464ef2 is responsible for this.

jscheffner avatar Oct 05 '23 08:10 jscheffner

So it actually broke in v3.1.0, v3.0.0 works fine.

jscheffner avatar Oct 05 '23 08:10 jscheffner

Suspected it had with that todo.. will have to find a solution

On Thu, 5 Oct 2023, 10:52 Jonas Scheffner, @.***> wrote:

So it actually broke in v3.1.0, v3.0.0 works fine.

— Reply to this email directly, view it on GitHub https://github.com/cloudamqp/amqp-client.js/issues/94#issuecomment-1748408767, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABL6TTU7QMF7DTC6WH5V5DX5ZYNLAVCNFSM6AAAAAA5SSU5IGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBYGQYDQNZWG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

carlhoerberg avatar Oct 05 '23 09:10 carlhoerberg

A spec is the first step

On Thu, 5 Oct 2023, 11:44 Carl Hörberg, @.***> wrote:

Suspected it had with that todo.. will have to find a solution

On Thu, 5 Oct 2023, 10:52 Jonas Scheffner, @.***> wrote:

So it actually broke in v3.1.0, v3.0.0 works fine.

— Reply to this email directly, view it on GitHub https://github.com/cloudamqp/amqp-client.js/issues/94#issuecomment-1748408767, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABL6TTU7QMF7DTC6WH5V5DX5ZYNLAVCNFSM6AAAAAA5SSU5IGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBYGQYDQNZWG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

carlhoerberg avatar Oct 05 '23 09:10 carlhoerberg