private static void Main(string[] args) { if (args.Length != 4) { Console.Out.WriteLine("Subscriber - Incorrect number of arguments"); Console.ReadLine(); return; } string processName = args[0]; string processUrl = args[1]; string puppetMasterUrl = args[2]; string siteName = args[3]; Subscriber subscriber = new Subscriber(processName, processUrl, puppetMasterUrl, siteName); BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider(); serverProv.TypeFilterLevel = TypeFilterLevel.Full; IDictionary prop = new Hashtable(); int port; string serviceName; if (!Utility.DivideUrl(processUrl, out port, out serviceName)) { Console.WriteLine("Invalid process URL"); Console.ReadLine(); return; } prop["port"] = port; prop["name"] = serviceName; try { TcpChannel channel = new TcpChannel(prop, null, serverProv); ChannelServices.RegisterChannel(channel, false); RemotingServices.Marshal(subscriber, prop["name"].ToString(), typeof (ISubscriber)); } catch (Exception ex) { Console.Out.WriteLine("********************************************"); Console.Out.WriteLine("*\tERROR: A problem occured while registering this service"); Console.Out.WriteLine("*\t" + ex.Message); Console.Out.WriteLine("*********************************************"); Console.ReadLine(); } Console.WriteLine(@"Running " + processName + " at " + processUrl + " - " + siteName); Console.ReadLine(); }
static void Main(string[] args) { if (args.Length < 3) return; Subscriber s = new Subscriber(args[0], args[1], args[2]); s.Start(); }
public static void Main(string[] args) { Console.WriteLine("Subscriber {0} started...", args[0]); var subscriber = new Subscriber(); subscriber.Subscribe(); }
static void Main(string[] args) { char[] delimiter = { ':', '/' }; string[] arg = args[2].Split(delimiter, StringSplitOptions.RemoveEmptyEntries); Console.WriteLine("Subscriber Application " + arg[2]); TcpChannel subChannel = new TcpChannel(Int32.Parse(arg[2])); ChannelServices.RegisterChannel(subChannel, false); //Add Sub to Broker. IBroker broker = (IBroker)Activator.GetObject( typeof(IBroker), args[3]); Subscriber subscriber = new Subscriber(args[0],args[2], args[3],broker); RemotingServices.Marshal(subscriber, "sub", typeof(Subscriber)); broker.addSubscriber(args[0], args[2]); Console.ReadLine(); }