Azure Service Bus queues - azure

I'm new to azure cloud and my assignments requires me to implement service bus queues.
Question: Implement the Service Bus queues in your application. By using the queues and Service Bus, you will be able to manage the communication between the N-tier applications in Azure.
I have made a library management system using .net C# and not in MVC. and deployed it in the cloud. I don't know how to implement it.
Do i need to make new project for service bus or can i implement it on the existing system.
I have made a form page with Fullname, Email, Subject and Message Box. there is submit Button and onclick event can i implement service bus queue? help please. Thank you for time. Sorry for asking question in unclear manner. New to stackoverflow.

I believe you have already create the service bus queue, still you may check https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quickstart-portal for your reference.
Then, you need to leverage the nuget pacakges in your project so that you can send messages to and receive messages from a Service Bus queue :
https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dotnet-get-started-with-queues
For more related details : https://github.com/toddkitta/azure-content/blob/master/articles/service-bus/service-bus-dotnet-how-to-use-queues.md
https://www.c-sharpcorner.com/article/azure-service-bus-queues/
https://www.c-sharpcorner.com/article/azure-service-bus-and-queue-implementation-using-c-sharp-small-intro-and-sample-app/
https://azuresdkdocs.blob.core.windows.net/$web/dotnet/Azure.Messaging.ServiceBus/7.0.0-preview.1/api/index.html

Related

Write a listener application for Azure Service Bus Queue

I need to have a listener app in .NET Core which will continuously look into new messages in Azure Service Bus Queue. I've tried so far with different approaches, but only able to read messages from ASB queue which are already published to queue before my listener application has started consuming. But once all the existing messages are processed and then the listener is not able to read any new messages from ASB queue.
I'm trying to figure out whether there is any method in the namespace "Azure.Messaging.ServiceBus" which will continuously pull messages from ASB queue.
I do not want to create a WHILE loop or a long running Task.
Any help is appreciated.
There are 4 ways to create an "Azure Service Bus Queue". This could be the long procedure to understand. To make it precise, I am attaching the links to follow for different methods of creation.
ARM Template : https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-resource-manager-namespace-queue
Powershell: https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quickstart-powershell
Azure CLI: https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quickstart-cli
Azure Portal: https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quickstart-portal
The Suitable answer for the requirement:
The receive modes are two types.
Receive and Delete
Peek lock
We can receive the message and pull it to read using Azure.Messaging.ServiceBus as required. Using the namespaces and utilizing the services of Azure.Messaging.ServiceBus

Azure Service Bus Subscription

i want to develop a Game using Azure Cloud but i am not sure which ressources i could use for it. Folowing is my problem:
There is one publisher which is providing some messages. I need to find a way to add subscriber on demand. That means whenever i need more subscriber i need to add them without changing any settings on the portal.
All subscriber needs to get the published message at the same time.
Received message from the publisher needs to be deleted for all subscriber at the same time.
Is there a ressource or a way which fits theese needs?
Thanks.
Azure SignalR Service is WebSocket Gateway service that covers all your requirements.
While you could always host your own server, the service supports scaling out.

How to implement Azure Message Queue in the WebAPI

I have multiple WebApi that are hosted in Azure but some of the API taking a long time to process.
Instead of a calling from the scheduler function in Azure, I was advised to use the Messaging Queue.
Is this a good approach?
Also, let say my API URL.. https://testwebapi.net/api1 and https://testwebapi.net/api2, how can we communicate these API using Message queue and also how to call the WebAPI individually from Messaging Queue?
Is this Azure Bus service is the same as Messaging Queue for Azure.
I would strongly recommend you look at the respective docs on Azure, and start doing some quick tutorials and post more specific questions.
Now, to answer, what I believe is your main question, Azure Bus Service and Messaging Queue.
The thing is, there is no one Messaging Queue, rather three options for Azure messaging - Service Bus, Event Grid, and Event Hubs. Also, there is something called 'Azure Queue Storage', but I dont think you are thinking of that, considering your context.
There is a very cool comparison chart available here - https://learn.microsoft.com/en-us/azure/event-grid/compare-messaging-services
But, I think, my guess, is you are looking for ultimately looking to use Azure Service Bus.
Also, please understand that one does not invalidate the other. As your project develops, you may end up using Azure Service Bus with other options like Event Hubs or Grids or all of them in different places.
Also, you keep using the incorrect terms. for example, you say 'Azure Bus service' but its really 'Azure Service Bus'. Also, there is no thing called 'Messaging Queue for Azure.' as there are so many different messaging services for Azure. This is what I want to add here. Spent some time with the docs and post more specific questions as you continue your project.

Azure Service Bus - can I view scheduled messages?

Similar past question of mine: Azure Service Bus Queue: Can I manage/cancel scheduled messages? - accepted answer here details how to cancel scheduled messages.
I'm wondering now if there's a way to view scheduled messages using the AMQP APIs. The Azure UI (and this method https://learn.microsoft.com/en-gb/java/api/com.microsoft.azure.management.servicebus._message_count_details?view=azure-java-stable) offer message counts but I can't see anything that lets me actually view those messages.
Is this a limitation of the service bus/Azure architecture? Or is there an API that will allow it? My goal would be to build a nice UI that displays scheduled tasks, and ideally I'd like to do that without maintaining that list of tasks myself outside of Azure if possible.
As of today, all messages can be peeked, but there's no way to peek those based on message status. There's an open issue on GitHub for the broker to add this feature. You can leave use-case scenario to help product team to have an idea why a feature as such would help customers.
Adding some information I found useful while reading about this.
Azure Service Bus Queues allows browsing/peeking scheduled messages.
Azure Service Bus Subscriptions does not support this feature yet.
Read More
View Example

Monitor azure service bus queue length

Team,
I would like to monitor a azure service bus dead letter queue length using normal C#. it should throw an exception when the receiver is not able/late to process messages from the active queue and due to time delay the count in the dead letter queue increases.
Is there a way without using ApplicationInsights ?
While using the full framework .NET client still provides message counts, according to the Azure Service Bus team the advised way is to use Azure Monitor service. The service has a .NET client that can be used to obtain the needed information (example). Service Bus team has also published a sample here. The client has not provided all the information in the past, but that is work in progress and could be different now than before.
In case you're still planning to use Service Bus client to retrieve message counts, I highly advise to use .NET Standard client rather than full framework client. The "new" client doesn't have NamespaceManager, but it has an equivalent, ManagementClient that will provide the functionality you're looking for, including improvements over its predecessor and bug fixes moving forward. The "old" client is on a limited support only.
If you are using the "old" Service Bus SDK, you can get it from MessageCountDetails:
var msg = NamespaceManager.CreateFromConnectionString(connectionString);
var queue = msg.GetQueue(queueName);
var dlqCount = queue.MessageCountDetails.DeadLetterMessageCount;
It is possible to fetch the Count of Messages(both active and dead-letter) in a Queue with the help of the latest Azure Monitor Metrics. Or you can make use of the Azure Monitor in Azure portal, which allows you to configure dashboards and alerts.

Resources