Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Inputs To Azure Function

TLDR:

Is it possible to have multiple inputs to an Azure Function?

Longer Explanation:

I'm new to Azure Functions and still don't have a good understanding of it.

I have an application which downloads HTML data through a proxy web request and I was considering moving it to Azure Functions.

However, the function would require two inputs: a string URL and a proxy object (which contains IP address, username and password properties).

I was thinking of having two queues, one for URLs and one for proxies.

URLs would be added to the queue by a client application, which would trigger the function.

The proxy queue would have a limited pool of proxy objects which would be added back into the queue by the consuming function after they had been used for the web request.

So, if there are no proxies in the proxy queue, the function will not be able to create a web request until one is added back into the queue.

This is all assuming that Azure Functions are parallel and every trigger from the URL queue runs a function on another thread.

So, is what I'm considering possible? If not, is there an alternative way that I could go about it?

like image 819
Aaron Avatar asked Jul 03 '26 12:07

Aaron


1 Answers

There can be only one trigger for a given function, i.e. the function will run when there is a new message in one specified queue.

There is an input bindings feature, which can load additional data based on the properties from triggering request. E.g. if incoming queue message contains URL and some proxy ID, and proxy settings are stored as Table Storage entities (or blobs), you could define an input binding to automatically load proxy settings based on ID from the message. See this example.

Of course, you could achieve the same without input binding, just by loading the proxy settings manually in function body based on your custom logic.

There is no way to setup a Function not to be triggered until you have messages in two queues at the same time.

like image 97
Mikhail Shilkov Avatar answered Jul 06 '26 10:07

Mikhail Shilkov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!