How can I use Azure Storage Queue trigger in a BackgroundService with a name resolver
I have a custom interface that I want to mix some controller endpoints with a constantly running background service and utilise the trigger functionality available to Azure Storage Queue's.
It wasn't too difficult to add a background service to an asp.net core web app.
public class ScheduledSyncWorker : BackgroundService
{
public ScheduledSyncWorker( ISyncConfiguration syncConfiguration)
...
}
I'm now trying to add the QueueTrigger methods and use a name resolver
// SyncingTriggersQueueNameToken = "synctriggerqueue"
public static void HandleIncomingSync([QueueTrigger("%" + SyncingTriggersQueueNameToken + "%")] QueueMessage myQueueItem, ILogger log)
{
log.Info($"C# function processed: {myQueueItem}");
try
{
... Do some significant processing. More than an azure function can handle like stick it in the database.
}
catch (Exception ex)
{
_logger.Error(ex);
throw;
}
}
Obviously the "%synctriggerqueue%" needs a resolver with access to configuration but how do I get that into the resolver.
Can I even have a resolver in a backgroundservice??? or do I need to abandon that for a webjob.
Normally I would be able to work this out however the excessive over promotion of azure functions is making it hard to build any proper applications doe to the inability to search the search engines for documentation.