Search code examples
azureblazor-server-sideazureservicebusazure-servicebus-queues

Blazor Server with Azure Service Bus Messaging


I am far from an expert in this topic, so I would need your advice.

Whar are the possibilities of listening to a Azure Service Bus Queue in a Blazor Server web application? When I have looked through more or less all examples on this topic, the messages are usually sent by a web application but consumed by a console app.

What i have done so far is that i have implement the creation of the messages (sender functionality) into an existing rest api. That is straight forward i guess, and it seems to work just fine.

How to handle the web site is another topic, but i want a sign in and out functionality of the listener. We can see it as a go LIVE feature. To manage this, i implemented the processor logic instead on the receiver logic, so that i can sign in and out of the message event.

Can this work? Or shall i do something different instead?

It somehow works, but there are errors that interfere and i am not skilled enough to say if this is possible or not.


Solution

  • You can take a look at the SignalR chat app sample for guidance. You can replace the SignalR code with your ServiceBus client logic and there should be no issue.

    The sample also contains buttons to start/stop the chat similar to your requirement for login/logout.