Hi I understand that if I create an azure function , which is triggered by a msg in a queue, can scale out (horizontally) if there are multiple messages in the queue.In other words, multiple instances of the same azure function can be running to process the msgs in the queue.
I also know that in an azure function I can get the ID of the running instance. Lets assume when an instance of my azure function starts I store the ID of the running instance in a database.
Now, my question is, how can I stop/kill a specific instance (identified by the stored ID) of my azure function programmatically?
THANKS IN ADVANCE!!
THE SCENARIO
I have a dashboard for my users. Where they can create a task.Once the task is created the definition goes to the queue along with user id as a msg. And as soon as the msg is available in the queue the azure function gets triggered. Now when the user refreshes the dashboard she/he sees the list of tasks (created by him/her) whether they are running or done. I am now required to give them an option to stop a running task as well.
Now multiple users can create the tasks with different params sending multiple msgs in the same queue which will result in running multiple instances of the same azure function. Each instances are tied with specific user. And if the user chooses to stop a task (which is the instance of that same azure function) I need to stop that specific instance of the azure function (not same as disabling the entire azure function).Now all i know about a running instance is the ID , and I was wondering if I can stop/kill/cancel that specific function instance from code.
I hope i successfully explained my situation. if you have more questions please let me know.