Beispiel #1
0
        static void Main(string[] args)
        {
            var subscriberService = new SubscriberService();

            using (IConnection connection = new ConnectionFactory().CreateConnection())
            {
                subscriberService.Run(connection);
                Console.WriteLine("Events listening started. Press any key to exit");
                Console.ReadKey();
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var  subscriberService = new SubscriberService();
            bool isCancel          = false;

            string natsHost = Environment.GetEnvironmentVariable("NATS_HOST");
            string natsPort = Environment.GetEnvironmentVariable("NATS_PORT");

            using (IConnection connection = new ConnectionFactory().CreateConnection("nats://" + natsHost + ":" + natsPort))
            {
                subscriberService.Run(connection);
                Console.WriteLine("Events listening started");
                Console.CancelKeyPress += (sender, args) => { isCancel = true; };
                while (!isCancel)
                {
                }
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            string currentDirectoryPath = Directory.GetCurrentDirectory();
            string jsonPath             = Directory.GetParent(currentDirectoryPath) + "/config/config.json";
            var    config = new ConfigurationBuilder()
                            .SetBasePath(Directory.GetCurrentDirectory())
                            .AddJsonFile(jsonPath, optional: false)
                            .Build();

            var subscriberService = new SubscriberService();

            using (IConnection connection = new ConnectionFactory().CreateConnection($"http://localhost:{config.GetValue<int>("NatsPort")}"))
            {
                subscriberService.Run(connection);
                Console.WriteLine("Text ranking starting:");
                Console.ReadKey();
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            var subscriberService = new SubscriberService();

            using (IConnection connection = new ConnectionFactory().CreateConnection("nats://" + Environment.GetEnvironmentVariable("NATS_HOST")))
                using (ConnectionMultiplexer redis = ConnectionMultiplexer.Connect(Environment.GetEnvironmentVariable("REDIS_HOST")))
                {
                    subscriberService.Run(connection, redis);
                    Console.WriteLine("TextRankCalc listening started.");

                    Task.Factory.StartNew(() =>
                    {
                        while (true)
                        {
                            Console.WriteLine(DateTime.Now.ToString());
                            Thread.Sleep(1000);
                        }
                    });
                    Console.CancelKeyPress += new ConsoleCancelEventHandler(OnExit);
                    _closing.WaitOne();
                }
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            var subscriber = new SubscriberService();

            using (IConnection nats = new ConnectionFactory().CreateConnection("nats://" + Environment.GetEnvironmentVariable("NATS_HOST")))
                using (ConnectionMultiplexer redis = ConnectionMultiplexer.Connect(Environment.GetEnvironmentVariable("REDIS_HOST")))
                {
                    subscriber.Run(nats, redis);

                    Console.WriteLine("TextRankCalc service is started");

                    Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e)
                    {
                        e.Cancel        = true;
                        Program.running = false;
                    };

                    while (running)
                    {
                    }

                    Console.WriteLine("TextRankCalc service is shut down");
                }
        }