Azure / Azure/Azure-Functions

Enhancement request. Allow wrapping `FunctionExecutor`

Open
#883 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

I'm currently in the middle of writing a package to provide function level dependency injection using `SimpleInjector` but have hit a road block due to the fact that I cannot control the container scope from neither my `IBinding` or `IBindingProvider` implementations. The code works great if the container's default lifestyle is `Singleton` but any `Scope` typed lifestyle requires the initialization of an explicit scope declaration. From peering into the code it looks like `FunctionExecutor.TryExecuteAsync` is responsible for actually running the webjob function itself. It would be nice to be able to wrap this call in some type of generic representation. In my situation I would wrap it with an explicit scope. Here is a pseudo example of what I am talking about


public static void ProcessQueueMessage([TimerTrigger("0 */1 * * * *", RunOnStartup = true)] //At 11:59PM
TimerInfo info, ICancelWroBoxProcess logic, TraceWriter writer)
{
writer.Info($"InstanceId: {logic.UniqueId}");
logic.Begin();
}

public void MyWrapper()
{
using (AsyncScopedLifestyle.BeginScope(Container))
{
FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance, CancellationToken cancellationToken)
}
}

For now I will try to figure out how I can make this work.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.