static void Main(string[] args) { if (args.Count() > 0) { string compName = args[0]; if ("kafkaspout".Equals(compName)) { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "TxKafkaPro-KafkaSpout"); SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(KafkaSpout.Get)); } else if ("partial-count".Equals(compName)) { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "TxKafkaPro-PartialCount"); SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(PartialCount.Get)); } else if ("count-sum".Equals(compName)) { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "TxKafkaPro-CountSum"); SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(CountSum.Get)); } else { throw new Exception(string.Format("unexpected compName: {0}", compName)); } } }
/// <summary> /// Start this process as a "Generator/Splitter/Counter", by specify the component name in commandline /// If there is no args, run local test. /// </summary> /// <param name="args"></param> static void Main(string[] args) { if (args.Count() > 0) { string compName = args[0]; if ("generator".Equals(compName)) { // Set the environment variable "microsoft.scp.logPrefix" to change the name of log file System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "HelloWorld-Generator"); // SCPRuntime.Initialize() should be called before SCPRuntime.LaunchPlugin SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(Generator.Get)); } else if ("splitter".Equals(compName)) { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "HelloWorld-Splitter"); SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(Splitter.Get)); } else if ("counter".Equals(compName)) { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "HelloWorld-Counter"); SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(Counter.Get)); } else { throw new Exception(string.Format("unexpected compName: {0}", compName)); } } else// if there is no args, run local test. { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "HelloWorld-LocalTest"); SCPRuntime.Initialize(); // Make sure SCPRuntime is initialized as Local mode if (Context.pluginType != SCPPluginType.SCP_NET_LOCAL) { throw new Exception(string.Format("unexpected pluginType: {0}", Context.pluginType)); } LocalTest localTest = new LocalTest(); localTest.RunTestCase(); } }
/// <summary> /// Start this process as a "Generator/Displayer/Tx-Generator/Tx-Displayer", by specify the component name in commandline /// If there is no args, run local test. /// </summary> /// <param name="args"></param> static void Main(string[] args) { string compName = args[0]; if ("generator".Equals(compName)) { // Set the environment variable "microsoft.scp.logPrefix" to change the name of log file System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "HybridTopology-Generator"); // SCPRuntime.Initialize() should be called before SCPRuntime.LaunchPlugin SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(Generator.Get)); } else if ("displayer".Equals(compName)) { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "HybridTopology-Displayer"); SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(Displayer.Get)); } else if ("tx-generator".Equals(compName)) { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "HybridTopology-TxGenerator"); SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(TxGenerator.Get)); } else if ("tx-displayer".Equals(compName)) { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "HybridTopology-TxDisplayer"); SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(TxDisplayer.Get)); } else { throw new Exception(string.Format("unexpected compName: {0}", compName)); } }
static void Main(string[] args) { if (args.Count() > 0) { //The component to run string compName = args[0]; //Run the component if ("twitterspout".Equals(compName)) { //Set the prefix for logging System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "TweetSentiment-Spout"); //Initialize the runtime SCPRuntime.Initialize(); //Run the plugin (WordSpout) SCPRuntime.LaunchPlugin(new newSCPPlugin(TwitterSpout.Get)); } else if ("sentimentindexerbolt".Equals(compName)) { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "TweetSentiment-Indexer"); SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(SentimentIndexerBolt.Get)); } else if ("hbasewriterbolt".Equals(compName)) { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "TweetSentiment-Writer"); SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(HBaseWriterBolt.Get)); } else if ("hbasecounterbolt".Equals(compName)) { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "TweetSentiment-Counter"); SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(HBaseCounterBolt.Get)); } else if ("signalrbroadcastbolt".Equals(compName)) { System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "TweetSentiment-Broadcast"); SCPRuntime.Initialize(); SCPRuntime.LaunchPlugin(new newSCPPlugin(SignalRBroadcastBolt.Get)); } else { throw new Exception(string.Format("unexpected compName: {0}", compName)); } } else { //Set log prefix information for the component being tested System.Environment.SetEnvironmentVariable("microsoft.scp.logPrefix", "TweetSentiment-LocalTest"); //Initialize the runtime SCPRuntime.Initialize(); //If we are not running under the local context, throw an error if (Context.pluginType != SCPPluginType.SCP_NET_LOCAL) { throw new Exception(string.Format("unexpected pluginType: {0}", Context.pluginType)); } //Create an instance of LocalTest LocalTest localTest = new LocalTest(); //Run the tests localTest.RunTestCase(); } }