Example #1
0
        static void Main(string[] args)
        {
            XmlConfigurator.Configure();

            var eventingServer = new EventingServer(new RequestHandler());
            var pullServer     = new PullServer();

            eventingServer.EnablePullDeliveryUsing(pullServer);
            eventingServer.Bind(FilterMap.DefaultDialect, typeof(JmxNotificationFilter));

            Console.WriteLine("WARNING! TimedOut exception which will cause your Visual Studio to break into");
            Console.WriteLine("debugging mode are part of WS-Eventing protocol and should be skipped");
            Console.WriteLine("with F5 while debugging.");
            Console.WriteLine();

            var client = new EventingClient("http://localhost:12345/Eventing");

            client.BindFilterDialect(FilterMap.DefaultDialect, typeof(JmxNotificationFilter));

            using (new HttpListenerTransferEndpoint("http://localhost:12345/", eventingServer, pullServer))
            {
                using (client.SubscribeUsingPullDelivery <EventData>(
                           x => Console.WriteLine(x.Value),
                           true,
                           new Filter(FilterMap.DefaultDialect, new JmxNotificationFilter())))
                {
                    Console.WriteLine("Press any key to exit.");
                    Console.ReadKey();
                }
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            DebugLog.Show("KKServer 正在启动");
            try
            {
                int port              = int.Parse(ConfigurationSettings.AppSettings["port"]);
                int numConnections    = int.Parse(ConfigurationSettings.AppSettings["numConnections"]);
                int receiveBufferSize = int.Parse(ConfigurationSettings.AppSettings["receiveBufferSize"]);
                int overtime          = int.Parse(ConfigurationSettings.AppSettings["overtime"]);

                _server = new PullServer(numConnections, receiveBufferSize, overtime, port);

                DebugLog.Show("KKServer 启动成功");

                // message.CMDID = System.BitConverter.ToInt16(buffer, 2);
            }
            catch
            {
                DebugLog.Show("KKServer 4321端口被占用,启动失败");
            }
        }
Example #3
0
 public static void EnablePullDeliveryUsing(this EventingServer eventingServer, PullServer pullServer)
 {
     eventingServer.Subscribed   += (s, args) => pullServer.RegisterPullHandler(args.Identifier, new EventingPullHandler(args.EventSource));
     eventingServer.Unsubscribed += (s, args) => pullServer.UnregisterPullHandler(args.Identifier);
 }