Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Functions Preview on .NET 5 #131

Closed
johnkors opened this issue Feb 16, 2021 · 7 comments
Closed

Azure Functions Preview on .NET 5 #131

johnkors opened this issue Feb 16, 2021 · 7 comments

Comments

@johnkors
Copy link

Hi,

Any thoughts on how to get an endpoint working with the new Azure Functions SDK (for .NET 5 support)?

See https://github.com/Azure/azure-functions-dotnet-worker-preview

@SeanFeldman
Copy link
Contributor

SeanFeldman commented Feb 16, 2021

Thank you, @johnkors, for raising the question.

Azure Functions out-of-process worker is not GA-ed and is not possible to run in production. Isn't that the case? It also doesn't even support all the standard triggers currently as stated in README.MD. Note that Particular Previews are supported in production, and customers expect to be able to use those in their production workloads. Once the out-of-process Functions worker is stable to be used in production, we'll be looking at what's needed for it.

What's your current use case, and how would you use it given the information above? Thank you.

@johnkors
Copy link
Author

My use case is I'm working in a .NET 5 code base, so ideally the function would also be running 5 instead of 3.1.

I by chance used C# records instead of classes to define my message contracts, which are not supported in 3.1. Not big issue to convert to classes and use 3.1 functions, just wanted to investigate if it was feasible to run on the preview first.

FWIW, I got a Function sample up with ServiceBusBinding on 5 that triggers fine, but currently lack a way of getting hold of MessageId/Headers to pass to the NServiceBus bridge (IFunctionEndpoint.Process).

Not critical, just wondered if you had looked at the previews and had some pointers. Totally understandable if you want to wait for GA.

@johnkors
Copy link
Author

johnkors commented Feb 16, 2021

Btw, for anyone other than me interested, my current hacks are:

.ConfigureFunctionsWorker((_, b) =>
{
    b.Services.AddSingleton<IFunctionEndpoint,FunctionEndpoint>(
        a => new FunctionEndpoint(b => new ServiceBusTriggeredEndpointConfiguration("My.Functions", "ASB_CONNECTIONSTRING")));
    b.UseFunctionExecutionMiddleware();
})
// from microsoft.azure.functions.worker/1.0.0-preview3
using FunctionExecutionContext = Microsoft.Azure.Functions.Worker.Pipeline.FunctionExecutionContext;

[FunctionName("PreviewTest")]
public Task Run(
  [ServiceBusTrigger("My.Functions", Connection = "ASB_CONNECTIONSTRING")] string body, 
  FunctionExecutionContext context)
{    
    var endpoint = context.InstanceServices.GetService<IFunctionEndpoint>();    
    endpoint.Process(..);
}

Unfortunately it only works to define the ServiceBusTrigger parameter as a string, which only provides the body of the message. There is some ongoing effort to investigate it at least (issues/106 , issues/39, issues/46 ). Haven't found a way to get hold of MessageId & Headers yet..

@SeanFeldman
Copy link
Contributor

SeanFeldman commented Feb 16, 2021

Given how in-flux the support for out-of-process Functions is the ideal situation would be to let the dust settle on the Functions side and then look into adopting it for NServiceBus. Functions API can and will change, causing continuous catch-up. I also haven't seen a solid answer about supporting .NET 5 in production. Rather, an answer that this work is done to ensure .NET 6 is a smooth sail.

On the NServiceBus side, you have a guarantee that when Functions API changes are solid, the support for those will be added.
Thank you for asking and don't hesitate to raise any other questions/suggestions.

@SeanFeldman
Copy link
Contributor

The issue to support the upcoming isolated worker will be tracked in Particular/NServiceBus.AzureFunctions.Worker.ServiceBus#148

@SeanFeldman
Copy link
Contributor

@johnkors, are you still looking for Isolated Worker SDK support? If you do, please indicate on #148. Thank you.

@johnkors
Copy link
Author

johnkors commented Jun 7, 2021

Will do, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants