static void Main(string[] args) { if (args.Length != 6) { return; } foreach (string arg in args) { Console.WriteLine("Arg: " + arg); } int port; Int32.TryParse(args[0], out port); string serviceName = args[1]; Broker.name = args[2]; Broker.groupName = args[2]; // Group name will be overwritten if replication is active ordering = (args[3].ToUpper() == "NO" ? FileParsing.Ordering.No : (args[3].ToUpper() == "FIFO" ? FileParsing.Ordering.Fifo : FileParsing.Ordering.Total)); routing = (args[4].ToUpper() == "FLOODING" ? FileParsing.RoutingPolicy.Flooding : FileParsing.RoutingPolicy.Filter); logging = (args[5].ToUpper() == "LIGHT" ? FileParsing.LoggingLevel.Light : FileParsing.LoggingLevel.Full); BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider(); IDictionary props = new Hashtable(); props["port"] = port; props["timeout"] = 15000; // 15 secs TcpChannel channel = new TcpChannel(props, null, provider); //TcpChannel channel = new TcpChannel(port); ChannelServices.RegisterChannel(channel, false); RemotingConfiguration.RegisterWellKnownServiceType( typeof(RemoteBroker), serviceName, WellKnownObjectMode.Singleton); //System.Console.WriteLine("Hi, I'm a broker..."); // addSubscriberToList(); // SendToSubscribers("banana"); System.Console.ReadLine(); }
static void Main(string[] args) { if ( args.Length != 6 ) { return; } foreach ( string arg in args ) { Console.WriteLine( "Arg: " + arg ); } int port; Int32.TryParse( args[ 0 ], out port ); string serviceName = args[ 1 ]; Broker.name = args[2]; Broker.groupName = args[ 2 ]; // Group name will be overwritten if replication is active ordering = (args[ 3 ].ToUpper() == "NO" ? FileParsing.Ordering.No : (args[ 3 ].ToUpper() == "FIFO" ? FileParsing.Ordering.Fifo : FileParsing.Ordering.Total)); routing = (args[ 4 ].ToUpper() == "FLOODING" ? FileParsing.RoutingPolicy.Flooding : FileParsing.RoutingPolicy.Filter); logging = (args[ 5 ].ToUpper() == "LIGHT" ? FileParsing.LoggingLevel.Light : FileParsing.LoggingLevel.Full); BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider(); IDictionary props = new Hashtable(); props[ "port" ] = port; props[ "timeout" ] = 15000; // 15 secs TcpChannel channel = new TcpChannel( props, null, provider ); //TcpChannel channel = new TcpChannel(port); ChannelServices.RegisterChannel(channel, false); RemotingConfiguration.RegisterWellKnownServiceType( typeof(RemoteBroker), serviceName, WellKnownObjectMode.Singleton); //System.Console.WriteLine("Hi, I'm a broker..."); // addSubscriberToList(); // SendToSubscribers("banana"); System.Console.ReadLine(); }