C
C#16mo ago
exergist

✅ Sequentially Queueing and Processing Async Messages

I have a websocket connection between two applications. I need to have one of the applications process received messages sequentially (finish processing first message before starting on second message). The receiving application has a single method where all received messages are processed. Assuming I can asynchronously collect received messages, how can I queue them for sequential processing based on the order they were received? Thank you!
5 Replies
exergist
exergist16mo ago
Ooo I'll give that a try!
exergist
exergist16mo ago
Thanks again @Doombox! I found these resources quite helpful on the subject: https://dotnetpattern.com/csharp-concurrentqueue https://github.com/YounesCheikh/ObservableConcurrentQueue
dotnetpattern.com
ConcurrentQueue in C# - Introduction and Examples
C# ConcurrentQueue is a thread-safe collection class. It is introduced in .NET 4.0 with other concurrent collection classes. Thread-safe FIFO data structure.
GitHub
GitHub - YounesCheikh/ObservableConcurrentQueue: Using System.Colle...
Using System.Collections.Concurrent.ConcurrentQueue with notifications - GitHub - YounesCheikh/ObservableConcurrentQueue: Using System.Collections.Concurrent.ConcurrentQueue with notifications
exergist
exergist16mo ago
!done what is the right way to close this thread?
Denis
Denis16mo ago
/close