Describe the bug
Apologies if I'm misunderstanding the buffering semantics. The following is based on how I've interpreted the documentation and related blog posts.
After tripping BufferingLimits::Maximum, the BackPressureAgent appears to restart the listener on the next invocation of BackPressureAgent::CheckNowAsync regardless of BufferingLimits::Restart. Note, this is not a bug in the BackPressureAgent itself.
Given the comment in the code, I suspect there is a very good reason that ListeningAgent::_receiver is disposed of and nulled out here. However, this has a side effect of driving _agent.QueueCount to 0 regardless of the state of the BufferedReciever.
To Reproduce
I haven't had time to attempt to write a test that might cover this, but I can try to work on that in the next few days.
Steps to reproduce the behavior:
- Create a minimal project with a single buffered endpoint with low
BufferingLimits (I tested with RabbitMQ)
- Add a single handler for a test message that delays for X seconds
- Flood the queue with enough messages to trip the back pressure limits
- Observe the listener is restarted on the next tick of the
BackPressureAgent::CheckNowAsync regardless of the receiver state
Expected behavior
A buffered endpoint should only restart the listener once the the receiver's queue drops below the BufferingLimits::Restart threshold.
Desktop:
- OS: Windows 11
- Version 4.12.2
Additional context
This might have some additional unintended consequences where multiple receivers are active for a listening agent. The disposed receiver appears to continue processing its internal queue in parallel with the receiver that's created on listener restart.
Describe the bug
Apologies if I'm misunderstanding the buffering semantics. The following is based on how I've interpreted the documentation and related blog posts.
After tripping
BufferingLimits::Maximum, theBackPressureAgentappears to restart the listener on the next invocation of BackPressureAgent::CheckNowAsync regardless ofBufferingLimits::Restart. Note, this is not a bug in theBackPressureAgentitself.Given the comment in the code, I suspect there is a very good reason that
ListeningAgent::_receiveris disposed of and nulled out here. However, this has a side effect of driving _agent.QueueCount to 0 regardless of the state of theBufferedReciever.To Reproduce
I haven't had time to attempt to write a test that might cover this, but I can try to work on that in the next few days.
Steps to reproduce the behavior:
BufferingLimits(I tested with RabbitMQ)BackPressureAgent::CheckNowAsyncregardless of the receiver stateExpected behavior
A buffered endpoint should only restart the listener once the the receiver's queue drops below the
BufferingLimits::Restartthreshold.Desktop:
Additional context
This might have some additional unintended consequences where multiple receivers are active for a listening agent. The disposed receiver appears to continue processing its internal queue in parallel with the receiver that's created on listener restart.