question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

changing queueOptions will crash next restart

See original GitHub issue

Let’s say you have a subscriber like this

@RabbitSubscribe({
  exchange: 'dummy',
  queue: 'my_queue' 
})

You push the app to prod, everything is fine (exchange created if it does not exist, queue created if it does not exist, binding betwen queue and excahnge)

now, you change an option like deadLetterExchange

@RabbitSubscribe({
  exchange: 'dummy',
  queue: 'my_queue',
  queueOptions: {
    deadLetterExchange: 'dead-letter-retry'
  }
})

The app will not start :

Operation failed: QueueDeclare; 406 (PRECONDITION-FAILED) with message "PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'my_queue' in vhost '/': received the value 'dead-letter-retry' of type 'longstr' but current is none"

I know this is the expected behavior from RabbitMq perspective (i.e multiple consumers may be bound to the queue so it is a bit unsafe to delete+recreate the queue automatically during assertQueue)

However, do you think this is the expected behavior with @RabbitSubscribe ?

I mean, if I explicitly specify the queue, it’s because I want the same queue for all running replicas … (besides, options do not really influence the running behavior of the queue from consumer point of view)

Will you accept a PR where we catch the failure of assertQueue to call deleteQueue + assertQueue ?

In any case, what do you suggest as a workaround to detect the situation automatically and to automatically delete the related queues before this lib calls assertQueue ?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
christopheblincommented, Jan 21, 2022

@underfisk I am the author of the PR so yes it address my concerns 😃

I dont have much time to upgrade the libs in our apps right now, but next app will definitively use the new assertQueueErrorHandler option

I’ll close this issue, feel free to reopen for any concerns you may have

0reactions
muhaliusmancommented, Jun 22, 2022

Hi @christopheblin, I still get an error even though I’ve replaced the error handler with forceDeleteAssertQueueErrorHandler. I think the handler is running but the error still occurs.

@Injectable()
export class ReceiptHandler {
  @RabbitSubscribe({
    exchange: 'events',
    routingKey: 'order.received',
    queue: 'sample_queue',
    queueOptions: {
        durable: false,
        deadLetterExchange: 'sample_dlx'
    },
    assertQueueErrorHandler: forceDeleteAssertQueueErrorHandler
  })
  public async pubSubHandler(msg: {}) {
    console.log(`Received message: ${JSON.stringify(msg)}`);
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

I'm Worried About A Stock Market Crash. How Can I Tell If My ...
In general, it refers to a very fast, very significant decline. Investors lose money as prices start falling, causing them to sell their...
Read more >
Queues | NestJS - A progressive Node.js framework
When Queue producers or consumers fail, their state is preserved and task handling can restart automatically when nodes are restarted.
Read more >
Welcome to Bull's Guide - GitHub Pages
Premium Queue package for handling distributed jobs and messages in NodeJS. View the Project on GitHub OptimalBits/bull. What is Bull? Bull is a...
Read more >
A Stock Market Crash In 2023? - InvestingHaven
Many investors are anxious about a stock market crash to start in 2023. ... Every call is subject to change if the underlying...
Read more >
A Life-Changing Investment Opportunity Is Coming ... - YouTube
In this video, learn how to make money while the entire stock market is down, and how to capitalize greatly on a stock...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found