I have an Azure function processing a file uploaded by end user which could take a long time. I'd like to notify the end user when process is completed. I'm not clear whether Azure event grid topic, event hub, service bus or other services would be best for this?
I'd like the user to be able to register how they would like to get notified as well. Is there an Azure service that would accomodate this?
You can use Azure Logic Apps to run your functions at a specific time and notify end users by email when finished for instance. Azure Logic Apps are used to run automated workflows that integrate your apps, data, services, and systems.
Link that could be helpful: Create and run your own code from workflows in Azure Logic Apps by using Azure Functions
You can use Signal R service by Azure. It will be useful in case you want to notify user on any real-time update from the server.
you can refer Signal R using Azure Function to implement it with azure function.
Related
I have a background worker that listens to a service bus (Azure Service bus) for messages.
Each message stands for an async task that the service should work on, but for the case that no event is reaching the bus, I also want to trigger the service automatically each day.
The service bus is currently triggered by user events that are generated in different APIs.
This works fine, but who should trigger my service with a certain schedule?
I could of course write a second service that sends a message to the bus each week, but it feels kind of overkill to have a service running only for this task.
I am wondering if there is a better solution how I could do this? Even an Azure Function seems overkill for me...
How would you address this issue?
Azure Functions are ideal because you can create both a timer triggered, and service bus triggered function in the same Function App.
If you feel it is excessive, I suggest the other option is to use the Azure Web jobs which can run in the App Services.
You can have timer-triggered Web jobs and use that Web job SDK to trigger them whenever there is a message in the Azure Service Bus.
Refer to the Scheduled Webjobs and Service Bus triggered webjobs for more information.
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.
I'm architecting an application used for team tasks management. The requirement is that every member of a team can add a task, and other members can see those tasks immediately.
The different services that I'm choosing are Azure Function, Azure Service Bus, Azure SQL DB and SignalR.
My idea is:
User adds a task in a Javascript client application in the Browser which will be sent to Azure Function.
Azure Function adds the user to the SQL DB. Sends an event called TaskAdded to Azure Service Bus.
SignalR receives the message, generate a new list of tasks and update client browsers in real time.
My question is, what communication/integration protocols (binding, message) should be used to make all the services work together to meet the requirement?
We are currently using Azure more like IAAS, rather than cloud services.
As a start, I would like to utilise Azure Messaging Queues to process some database actions and Web API calls.
I am assuming I would need to write another piece of code that subscribes to the queues, so when messages arrive, it knows to process the transaction?
Is that piece of code, a console app? runs on a scheduled task? a windows service? or a function app within azure?
What is the Best Practice for this architecture?
You can write console app and schedule web job to monitor the queue. However better way is to use Azure Functions. You don't have to monitor the queue then. Whenever the message arrives in the queue it will trigger Azure Function and you can process the message. The benefit is it's server-less.
I have looked through documentation for WebJobs, Functions and Logic Apps in Azure but I cannot find a way to schedule a one-time execution of a process through code. My users need to be able to schedule notifications to go out at a specific time in the future (usually within a few hours or a day from being scheduled). Everything I am reading on those processes is using CRON expressions which is not designed for one-time executions. I realize that I could schedule the job to run on intervals and check the database to see if the rest of the job needs to run, but I would like to avoid running the jobs unnecessarily if possible. Any help is appreciated.
If it is relevant, I am using C#, ASP.NET MVC Core, App Services and a SQL database all hosted in Azure. My plan was to use Logic apps to check the database for a scheduled event and send notifications through Twilio, SendGrid, and iOS/Android push notifications.
One option is to create Azure Service Bus Messages in your App using the ScheduledEnqueueTimeUtc property. This will create the message in the queue, but will only be consumable at that time.
Then a Logic App could be listening to that Service Bus Queue and doing the further processing, e.g. SendGrid, Twilio, etc...
HTH
You could use Azure Queue trigger with deferred visibility. This will keep the message invisible for a specified timeout. This conveniently acts as a timer.
CloudQueue queueOutput; // same queue as trigger listens on
var strjson = JsonConvert.SerializeObject(message); // message is your payload
var cloudMsg = new CloudQueueMessage(strjson);
var delay = TimeSpan.FromHours(1);
queueOutput.AddMessage(cloudMsg, initialVisibilityDelay: delay);
See https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.storage.queue.cloudqueue.addmessage?view=azure-dotnet for more details on this overload of AddMessage.
You can use Azure Automation to schedule tasks programmatically using REST API. Learn about it here.
You can use Azure Event Grid also. Based on this article you can “Extend existing workflows by triggering a Logic App once there is a new record in your database".
Hope this helps.
The other answers are all valid options, but there are some others as well.
For Logic Apps you can build this behavior into the app as described in the Scheduler migration guide. The solution described there is to create a logic app with a http trigger, and pass the desired execution time to that trigger (in post data or query parameters). The 'Delay Until' block can then be used to postpone the execution of the following steps to the time passed to the trigger.
You'd have to change the logic app to support this, but depending on the use case that may not be an issue.
For Azure functions a similar pattern could be achieved using Durable Functions which has support for Timers.