Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using Microsoft.Azure.WebJobs;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
namespace TestWebjob
{
public class Functions
{
// This function will get triggered/executed when a new message is written
// on an Azure Queue called queue.
public static void ProcessQueueMessage([QueueTrigger("webjobtestq")] string message, TextWriter log)
{
try
{
var javaHome = Environment.GetEnvironmentVariable("JAVA_HOME");
ProcessStartInfo psi = new ProcessStartInfo(javaHome + "\\bin\\java", string.Concat(" -jar .\\App_Data\\AzureWebjobJar.jar ", message))
{
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true
};
Process javaProcess = Process.Start(psi);
string theOutput = javaProcess.StandardOutput.ReadToEnd();
javaProcess.WaitForExit();
//code to craft email of output omitted
}
catch (Exception ex)
{
//code to craft email of exception omitted
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.