I have a service bus queue in Azure and a service bus queue trigger function. When I first publish a function and send a message to the service bus queue, the function starts and works fine.
But if I leave it alone and do not send any messages to the queue, say ~ 1 hour, and then send a message, the function does not start. I need to run the function again in the portal by clicking “run”, or I need to republish it to Azure.
How do I make it work, so I don’t need to restart it every hour or so ??? My application cannot send a new message to the queue for a couple of hours or even days.
FYI - I read here that the function is turned off after 5 minutes, I can’t use the functions, if so, and I don’t want to use the timer trigger, because then I will run the function more than I want, I spend money! Right? If my only, better choice is to start the timer function every 30 minutes during the day, I can just suck it up and do it, but I would prefer the function to execute when the message gets into the queue message.
FYI2 - ultimately I want to hide the message until a certain date when I first push it into the queue (for example, to display 1 week from the moment it is placed in the queue). What am I trying to do? I want to send an email to registered students after class, and a class can be assigned in 1-30 days. Therefore, when the class is planned, I do not want the function to run before the end of the class, which can be 1 week, 2 weeks 2 days, 3 weeks 3 days, etc. After the class was originally planned in my application.
Here is a snippet from a .json function
{ "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.0.0", "configurationSource": "attributes", "bindings": [ { "type": "serviceBusTrigger", "connection": "Yogabandy2017_RootManageSharedAccessKey_SERVICEBUS", "queueName": "yogabandy2017", "accessRights": "listen", "name": "myQueueItem" } ], "disabled": false, "scriptFile": "..\\bin\\PostEventEmailFunction.dll", "entryPoint": "PostEventEmailFunction.Function1.Run" }
Here is the function
public static class Function1 { [FunctionName("Function1")] public static void Run([ServiceBusTrigger("yogabandy2017", AccessRights.Listen, Connection = "Yogabandy2017_RootManageSharedAccessKey_SERVICEBUS")]string myQueueItem, TraceWriter log) { log.Info($"C# ServiceBus queue trigger function processed message: {myQueueItem}"); } }
I was asked to publish my payment plan
