Azure Functions are marketed as
More than just event-driven serverless compute
The event-driven part is key here. The actual Function in a Function app is the code that's triggered by for instance a timer, a message on a Service Bus or an Event Grid event. All other code should be supporting in getting that job done. If you have a Functions App that doesn't have any functions, you don't have any entry point for your code to run.
Two main remarks:
- It kinda feels like you're trying to abuse Functions
- Why not use Service Bus triggers instead of a thread doing the same thing manually?
Have a look at this example, taken from Azure Service Bus bindings for Azure Functions - Trigger - C# example:
[FunctionName("ServiceBusQueueTriggerCSharp")]
public static void Run(
[ServiceBusTrigger("myqueue", AccessRights.Manage, Connection = "ServiceBusConnection")]
string myQueueItem,
Int32 deliveryCount,
DateTime enqueuedTimeUtc,
string messageId,
ILogger log)
{
log.LogInformation($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
log.LogInformation($"EnqueuedTimeUtc={enqueuedTimeUtc}");
log.LogInformation($"DeliveryCount={deliveryCount}");
log.LogInformation($"MessageId={messageId}");
}
This example shows a C# function that reads message metadata and logs a Service Bus queue message.