Created
July 20, 2015 16:59
-
-
Save joymon/68bd40f985f8cad04a0e to your computer and use it in GitHub Desktop.
IPC using StdIn and Out Destination
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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