Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure functions calling onto native C++

I'm designing a new architecture in Azure. It's a multi-tenant SaaS application with an ASP.NET MVC front end and some application specific data in blob storage. I need to perform some background processing on this application data at certain points. This is currently only possible using some legacy C++ code (I can't realistically rewrite this in C#).

One thought I had was to push any background jobs onto a queue and use Azure functions to service the queue as and when a job gets pushed onto it. The sticking point is the native code. I can certainly expose methods in the native code that C# can p/invoke, but can Azure functions call onto native DLLs and if so is this a sensible approach?

like image 702
Ishyc Avatar asked Nov 07 '16 20:11

Ishyc


People also ask

How do I make an azure function call an HTTP client?

@EddynsonVega-8570As @kashyapa mentioned you can create the HttpClient object to make the HTTP calls within your azure function if you are using C# language function app. Depending upon your requirement you can create any of supported triggerto trigger your function app and your function app code will make the HTTP calls.

Is there any other way to call Azure function from another function?

Is there any other way to call Azure function with in another Azure function without full path as above? Show activity on this post. There's nothing built-in in Function Apps to call one HTTP function from other functions without actually making the HTTP call. For simple use cases I would just stick to calling by full URL.

Can I use native DLLs in Azure Functions?

YES, you can - use native DLLs in your Azure Functions via P/Invoke ( [DllImport]) as you already know it from .NET Framework, and safe the code you have developed and maintained for decades with much effort and patience. Illustrated guide on how to integrate a native DLL into Azure Functions.

Can I develop Azure functions using C #script (CSX)?

This article is an introduction to developing Azure Functions by using C# script ( .csx ). Azure Functions supports C# and C# script programming languages. If you're looking for guidance on using C# in a Visual Studio class library project, see C# developer reference.


1 Answers

The code does run in a sandbox, but this approach should work. (you may want to consider exposing the relevant API in a managed assembly that would in turn be consumed by your function).

Whether you'll run into limitations with the sandbox is dependent on what your code is doing, but you can learn more about the sandbox and its restrictions here: https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox

I hope this helps!

like image 79
Fabio Cavalcante Avatar answered Nov 12 '22 03:11

Fabio Cavalcante