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.

Declare passive queue but also get the queue object

See original GitHub issue

I’m migrating to net 5.0 and moving away from the 2.x version of this lib. Is there a way to replace these calls with something similar?

 // passive, throws exception if queue not found.
_queue = _bus.Bus.QueueDeclare(_config.QueueInfo.Name, true);

I’m asking because I’ve found that there is QueueDeclarePassive, but it has a void return type.

// create queue 
  _queue = _bus.Bus.QueueDeclare(
      name: _config.QueueInfo.Name,
      passive: false,
      durable: false,
      exclusive: false,
      autoDelete: _config.QueueInfo.AutoDelete,
      perQueueMessageTtl: ttl,
      maxLength: maxLen,
      maxLengthBytes: maxMem);

How can I set the TTL and maxLength?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
DmitriiGaidukovcommented, May 18, 2021

I too was looking for a way to declare a queue passively.

This workaround helped me.

await _bus.Advanced.QueueDeclarePassiveAsync("QueueName", stoppingToken);
var queue = new EasyNetQ.Topology.Queue("QueueName");

Of course, it isn’t really convenient. It seems the breaking change goes back to this PR https://github.com/EasyNetQ/EasyNetQ/pull/921

0reactions
Plinercommented, Jul 9, 2023

Hi @Sam-Lin-MillersLab,

QueueDeclarePassiveAsync only ensures that a queue with the provided name exists, therefore we still cannot construct a proper queue object, because do not know anything about the queue except its name.

#1678 only helps to fill in queue arguments.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RabbitMQ Failed to declare queue and Listener is not able ...
A RabbitAdmin is required to declare the queues/bindings; the container only does a passive declaration to check the queue is present.
Read more >
com.rabbitmq.client.Channel.queueDeclarePassive java ...
public static boolean isQueueAvailable(Channel channel, String queueName) throws IOException { try { // check availability of the named queue // if an error ......
Read more >
Queues
Declaring a queue will cause it to be created if it does not already exist. The declaration will have no effect if the...
Read more >
Chapter 5. Don't get messages; consume them - RabbitMQ in ...
1 Connects to RabbitMQ; 2 Opens a channel on the connection; 3 Creates a new instance of a queue object to interact with...
Read more >
Queue — rabbitpy 2.0.1 documentation - Read the Docs
The Queue class is used to work with RabbitMQ queues on an open channel. The following example shows how you can create a...
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