Hi there guys,
We've been struggling (like, a lot) to try and get Azure Functions working. We finally managed to call an http triggered function that writes messages on a queue and checked that queue triggered functions actually get executed (thanks again to everyone who gave us advice).
So, FunctionExecutionContext gets passed to the http triggered functions along with the request (as seen in the docs)but, how do we get it inside the queue triggered functions? So far we've tried getting it inside the http triggered function and serialize it as a json string and writing it to the queue itself. Something like this:
[FunctionName("HttpExample")] public static async Task<dynamic> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, [Queue("myqueue-items"),StorageAccount("AzureWebJobsStorage")] ICollector<string> msg, ILogger log) { FunctionExecutionContext<dynamic> context = JsonConvert.DeserializeObject<FunctionExecutionContext<dynamic>>(await req.ReadAsStringAsync()); string playFabContext = JsonConvert.SerializeObject(context); msg.Add(playFabContext); return new { messageValue = "Queue function should have been launched." }; }
The thing is that this http triggered function takes too long itself (over 1second), either because of the await for the request async read or because of all that json serializing.
Our question is: Is there a way of getting the FunctionExecutionContext inside the queue triggered function without passing it from the http triggered function? We're asking because we believe we will need the authentication context or something similar to work with PlayFab data from the queue triggered function.
Thanks in advance.
[Quick edit]: We tried writing the context directly to the queue without deserializing and serializing and we still get almost 1s execution time, so we believe it's the await for the request read async operation that takes most of the time.