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.

ReceiveAsync<T> does not respect PrefetchCount

See original GitHub issue

When running this code the PrefetchCount is not respected and multiple messages on the queue are consumed simultaneously:

await bus.SendReceive.ReceiveAsync<TestDto>("my.queue", async h =>
               {
                   await Task.Delay(2000);
               }              
               , config =>
               {
                   config.WithPrefetchCount(1);
                   config.WithDurable(true);
                   config.AsExclusive(false);
                   config.WithAutoDelete(false);
               });

This code consumes the messages one by one (as expected):

await bus.SendReceive.ReceiveAsync("my.queue", x => x
                .Add<TestDto>(async h =>
                {
                    await Task.Delay(2000);
                })
                , config =>
                {
                    config.WithPrefetchCount(1);
                    config.WithDurable(true);
                    config.AsExclusive(false);
                    config.WithAutoDelete(false);
                });

Is this the expected behaviour? I would expect the same behaviour from those two implementations.

  • EasyNetQ version: [7.3.5]
  • RabbitMQ version: [3.11.5]

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
olivermonbergcommented, Dec 19, 2022

Thanks for the fix. Closing this.

0reactions
Plinercommented, Dec 19, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - ActiveMQ + NMS. Prefetch limit not respected
My understanding of the prefetch is that a synchronous consumer will be sent x messages and then once it has acknowledged 50% of...
Read more >
ServiceBusTrigger: prefetchCount not respected when ...
Only prefetches 1 message, rather than 10 (as specified in the host.json file). This does not seem to be the expected behaviour.
Read more >
QueueClient.PrefetchCount Property
Remarks. When Prefetch is enabled, the client will quietly acquire more messages, up to the PrefetchCount limit, than what the application immediately asks...
Read more >
XPO Async/Await Methods for XPQuery, Session.Evaluate, ...
I've looked through the sources of XPQuery and XPBaseQuery but I don't see how I can build or get the where clause from...
Read more >
Async / Await vs. PipeTo in Akka.NET Actors
Assuming I have 100 actors and every actor will jump into await section inside ReceiveAsync and will wait 60seconds, will not that block...
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