Reputation: 571
I have been looking for a way to schedule events in azure but I have not found any.
What I am looking for is something like a function app triggered by an event hub message, but rather than triggering the function app whenever a new message arrives, trigger the function app in X amount of time after the message arrived (and the X amount of time is set in the message's properties).
The most similar resource I found is signalR, since I am not looking for a FIFO styled messaging system. Instead each client can potentially schedule different messages in the back end at the same time and the back end should be able to communicate back to those clients whenever the message was processed. Is signalR the correct resource to use for this?
Upvotes: 1
Views: 576
Reputation: 15621
There are a lot of ways to schedule events in Azure, and which one to take is, of course, highly dependent on the requirements you have.
If you want to
trigger the function app in X amount of time after the message arrived
there might be (at least) two options:
When a queue or subscription client receives a message that it's willing to process, but the processing isn't currently possible because of special circumstances, it has the option of "deferring" retrieval of the message to a later point. The message remains in the queue or subscription, but it's set aside.
Gets or sets the date and time in UTC at which the message will be enqueued.
By using option 1, you will need to keep track of all of your deferred messages yourself, which kind of renders Functions useless as a solution.
Using option 2, you delay the message for that period of time. You can do so by not setting the delay information on the metadata of the message, but by setting ScheduledEnqueueTime
.
For communicating the results of processing the messages back to the clients, either Azure Web PubSub or Azure SignalR can be used. You can check Azure Web PubSub service FAQ - How do I choose between Azure SignalR Service and Azure Web PubSub service? to see which service suits you best.
Upvotes: 1