Replies: 2 comments 4 replies
-
After some reading it appears event handlers execute on the initiating thread as standard in C#. I've handled this by spinning off the actual execution to a Task. One thing I did find was I had to set the AutoAcknowledge flag to false before passing in the parameter to the Task.
If I didn't do this, by the time my ProcessApplicationMessage method had got around to acknowledge the message, it had already been auto acknowledged. |
Beta Was this translation helpful? Give feedback.
-
@gfoidl I am also facing a similar issue. I am having some complex database operations in my ApplicationMessageReceivedAsync handler. I am facing a delay when the rate at which I receive messages is more than the rate at which I can process the message. In my scenario would you suggest use of Channels or is there a better way? |
Beta Was this translation helpful? Give feedback.
-
I have a delegate setup for ApplicationMessageReceivedAsync, and this is correctly processing the messages. I'm now in the process of stress testing, and handling multiple messages at once and it appears that the delegate is executing synchronously, processing each message in the order it's received.
I have a database operation within my delegate, and have delayed the acknowledgement until the ApplicationMessage has been successfully saved to the database. If this takes a few seconds for whatever reason, I don't want the other messages to be delayed.
Is it correct that the ApplicationMessageReceived delegate is running synchronously, and if so, is there an option to have it run asynchronously. If not, am I right in understanding, I have to handle the multiple threads within my delegate?
Beta Was this translation helpful? Give feedback.
All reactions