C
C#4w ago
Dibbels

How to put long running service into a .NET Rest API?

I am quite a C# newbie and need help with an architecture question. I want to build a C# API that provides an SSE route to send real-time messages to my frontend. The C# application will be connected to a RabbitMQ server. The goal is to send the processed message via SSE to the UI every time a message comes in through a RabbitMQ queue. How can I best integrate the RabbitMQ client into the C# application?
4 Replies
SineѶeҀҬOӶ⒉⓸⎤ᚙ▟ ▞╸
You create a class that handles the connection and dependency inject it as a singleton So you only have to handle a single instance of it throughout the application.
MODiX
MODiX4w ago
If you have no further questions, please use /close to mark the forum thread as answered
Dibbels
DibbelsOP4w ago
Thanks for the input 🙂 The Singleton solution seems to be perfect for my use case! Thanks 🙂

Did you find this page helpful?