public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequestMessage req, TraceWriter log) { // Get request body var messageBody = await req.Content.ReadAsStringAsync().ConfigureAwait(false); // Since we expect all the VSTS properties to be in the request headers, fetch them from the headers // var taskProperties = GetTaskProperties(req.Headers); // Create my own task execution handler. You should replace it with your task execution handler. ITaskExecutionHandler myTaskExecutionHandler = new MyTaskExecutionHandler(); var executionHandler = new ExecutionHandler(myTaskExecutionHandler, messageBody, taskProperties); var executionThread = new Thread(() => executionHandler.Execute(CancellationToken.None)); executionThread.Start(); return(req.CreateResponse(HttpStatusCode.OK, "Request accepted!")); }
public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, TraceWriter log) { TypeDescriptor.AddAttributes(typeof(IdentityDescriptor), new TypeConverterAttribute(typeof(IdentityDescriptorConverter).FullName)); TypeDescriptor.AddAttributes(typeof(SubjectDescriptor), new TypeConverterAttribute(typeof(SubjectDescriptorConverter).FullName)); AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; // Get request body var messageBody = await req.Content.ReadAsStringAsync().ConfigureAwait(false); // Fetch all the VSTS properties from the headers var taskProperties = GetTaskProperties(req.Headers); // Created task execution handler ITaskExecutionHandler myTaskExecutionHandler = new MyTaskExecutionHandler(); var executionHandler = new ExecutionHandler(myTaskExecutionHandler, messageBody, taskProperties); var executionThread = new Thread(() => executionHandler.Execute(CancellationToken.None)); executionThread.Start(); return(req.CreateResponse(HttpStatusCode.OK, "Request accepted!")); }