-
Notifications
You must be signed in to change notification settings - Fork 283
Open
Labels
Description
Describe the bug
In RmqMessageProducer.SendWithDelayAsync event handlers are added for each send and never removed.
Channel.BasicAcksAsync += OnPublishSucceeded;
Channel.BasicNacksAsync += OnPublishFailed;
Therefore, for the Nth send the event handler is called N times!
The fix should be to remove the events inside each of the event handlers.
To Reproduce
Set a breakpoint, or add debug print to RmqMessageProducer.OnPublishSucceeded() and RmqMessageProducer.OnPublishFailed()
Use any sample that sends messages to RMQ, for example https://github.com/BrighterCommand/Brighter/blob/master/samples/TaskQueue/RMQTaskQueue/GreetingsSender/Program.cs
Change code to send to the same chnnel multiple times, for example:
for (var i = 0; i < 10; i++)
{
commandProcessor.Post(new GreetingEvent("Ian says: Hi there!"));
commandProcessor.Post(new FarewellEvent("Ian says: See you later!"));
}
Verify that the Nth Post triggers the event handler N times!
Further technical details
- Brighter version: 10.3.0
Reactions are currently unavailable