Skip to content

Instantly share code, notes, and snippets.

@joymon
Created July 20, 2015 16:59
Show Gist options
  • Save joymon/68bd40f985f8cad04a0e to your computer and use it in GitHub Desktop.
Save joymon/68bd40f985f8cad04a0e to your computer and use it in GitHub Desktop.
IPC using StdIn and Out Destination
class Program
{
static void Main()
{
string[] args = Environment.GetCommandLineArgs();
if (args.Length == 1)
{
//Do nothing
}
else if (string.Equals(args[1],"-process"))
{
ProcessMessage();
}
}
private static void ProcessMessage()
{
Console.WriteLine("Inside Program.ProcessMessage()"); //This will be caught in the OutputDataRecived event handler
string serializedMsg = Console.ReadLine();
CustomQueueMessage msg=JsonConvert.DeserializeObject<CustomQueueMessage>(serializedMsg);
new MessageProcessor().Process(msg);//Do work with message object
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment