I'd like to directly read messages from Azure Service Bus with Nuclio using the Python runtime. Does anyone have experience with this?
I'm assuming I need to create the ServiceBusClient inside of an init_context function, but the examples from azure show that occurring within it's own context manager, like so:
conn_str = <CRED>
queue_name = <NAME>
with ServiceBusClient.from_connection_string(conn_str) as client:
with client.get_queue_receiver(queue_name, max_wait_time=30) as receiver:
for msg in receiver:
print(str(msg))
I'm assuming best practice would be to create the ServiceBusClient inside of init_context, then call setattr(context.user_data, 'my_servicebus', my_servicebus.from_connection_string())
Anyone have experience with this?
I suggest you explore connecting the Service Buss to Azure Event Hub. Although your idea of initiating the connection in init_context is a good start, you will have the complexity of managing the state and configuration of the ESB connection.
Nuclio includes an Azure Event Hub trigger. Not only will it simplify your deployment, but you will take advantage of Nuclio’s autoscaling and recovery options.
I found this article that seems to guide you through integrating ESB with Hub.
https://techcommunity.microsoft.com/t5/azure-paas-blog/how-to-send-messages-to-or-receive-from-service-bus-event-hub/ba-p/2136244
Related
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
We are designing synchronization between SAP and Salesforce.
Our architect propose pattern to use Azure Service Bus between them:
Our client want to use Azure Event Hub instead Azure Service Bus for this.
And client told us, that Event Hub is must have for that.
Reading documentation in my opinion Azure Service Bus should better fit for synchronization like Point-to-Point (from SAP database to Salesforce database).
Can somebody explain, why Event Hub can be better for synchronization like this?
What is good point for our client to use it?
Should we try to convince our client to change architecture to Service Bus?
I really didn't made integration using Event Hub so I don't know what should I expect for that.
I have a local machine that reads RabbitMQ queue messages.
I wish to move it to cloud. Which Azure service can be used in this case?
I went through event hubs, but I am not sure, if it would read messages from rabbitMQ continuously.
Any suggestions for the service that should be put to use.
You should take a look at Azure Service Bus. It has got FIFO queues as well as publish/subscribe capabilities. However if using Azure managed service is not a strict requirement you can use RabbitMQ on a VM (or a cluster for high availability) as well.
UPDATE: Your response means you want a managed service. There are 2 options - if you want to go with RabbitMQ but do not want to manage the infrastructure you can go for 3rd party service provider like CloudAMQP who will manage it on your behalf. The other option is to go for Cloud native messaging - meaning if you are on Azure you change your messaging service to Azure Service Bus. This would mean changing you code as well.
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.
I'm simply trying to work out how best to retrieve messages as quickly as possible from an Azure Service Bus Queue.
I was shocked that there wasn't some way to properly subscribe to the queue for notifications and that I'm going to have to poll. (unless I'm wrong in which case the documentation is terrible).
I got long polling working, but checking a single message every 60 seconds looks like it'll cost around £900 per month (again, unless I've misunderstood that). And if I add a redundant/second service to poll it'll double.
So I'm wondering what the best/most cost efficient way of doing it is.
Essentially I just want to take a message from the queue, perform an API lookup on some internally held data (perhaps using hybrid services?) and then perhaps post a message back to a different queue with some additional information .
I looked at worker roles(?) -- is that something that could do it?
I should mention that I've been looking at doing this with node.js.
Check out these videos from Scott Hanselman and Mark Simms on Azure Queues.
It's C# but you get the idea.
https://channel9.msdn.com/Search?term=azure%20queues%20simms#ch9Search
Touches on:
Storage Queues vs. Service Bus Queues
Grabbing messages in bulk vs. one by one (chunky vs. chatty)
Dealing with poison messages (bad actors)
Misc implementation details
Much more stuff i can't remember now
As for your compute, you can either do a VM, a Worker Role (Cloud Services), App Service Webjobs, or Azure Functions.
The Webjobs SDK and Azure Functions bot have a way to subscribe to Queue events (notify on message).
(Listed from IaaS to PaaS to FaaS - Azure Functions - if such a thing exists).
Azure Functions already has sample code provided as templates to do all that with Node. Just make a new Function and follow the wizard.
If you need to touch data on-prem you either need to look at integrating with a VNET that has site-to-site connectivity back to your prem, or Hybrid Connections (App Service only!). Azure Functions can't do that yet, but every other compute is a go.
https://azure.microsoft.com/en-us/documentation/articles/web-sites-hybrid-connection-get-started/
(That tutorial is Windows only but you can pull data from any OS. The Hybrid Connection Manager has to live on a Windows box, but then it acts as a reverse proxy to any host on your network).
To deal with Azure ServiceBus Queue easily, the best option seems to be Azure Webjob.
There is a ServiceBusTrigger that allows you to get messages from an Azure ServiceBus queue.
For node.js integration, you should have a look at Azure Function. It is built on top of the webjob SDK and have node.js integration :
Azure Functions NodeJS developer reference
Azure Functions Service Bus triggers and bindings for queues and topics
In the second article, there is an example on how get messages from a queue using Azure Function and nodejs :
module.exports = function(context, myQueueItem) {
context.log('Node.js ServiceBus queue trigger function processed message', myQueueItem);
context.done();
};