Example #1
0
        static void Main()
        {
            const string uri = "http://localhost:6156";
            var hermesClient = new HermesClient(uri);

            var topic = hermesClient.TryCreateGroup("Chat Server")
                                    .TryCreateTopic("Weather Channel");

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Publishing in topic \"{0}\" from group \"{1}\"", topic.Name, topic.Group.Name);
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
            string input;
            while (!string.IsNullOrEmpty(input = Console.ReadLine()))
            {

                var location = topic.PostStringMessage(input);
                Console.WriteLine();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Posted message {0}.", input);
                Console.WriteLine("You can get the message in:");
                Console.WriteLine(location);
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine();
            }
        }
Example #2
0
        static void Main()
        {
            const string uri          = "http://localhost:6156";
            var          hermesClient = new HermesClient(uri);

            var topic = hermesClient.TryCreateGroup("Chat Server")
                        .TryCreateTopic("Weather Channel");

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Publishing in topic \"{0}\" from group \"{1}\"", topic.Name, topic.Group.Name);
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
            string input;

            while (!string.IsNullOrEmpty(input = Console.ReadLine()))
            {
                var location = topic.PostStringMessage(input);
                Console.WriteLine();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Posted message {0}.", input);
                Console.WriteLine("You can get the message in:");
                Console.WriteLine(location);
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine();
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            const string uri = "http://localhost:6156";

            var hermesClient = new HermesClient(uri);

            var topic = hermesClient.TryCreateGroup("Chat Server")
                        .TryCreateTopic("Weather Channel");

            using (var subscription = topic.PollFeed(2).Subscribe(Console.WriteLine))
            {
                Console.ReadLine();
                subscription.Dispose();
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            const string uri = "http://localhost:6156";

            var hermesClient = new HermesClient(uri);

            var topic = hermesClient.TryCreateGroup("Chat Server")
                                    .TryCreateTopic("Weather Channel");

            using(var subscription = topic.PollFeed(2).Subscribe(Console.WriteLine))
            {
                Console.ReadLine();
                subscription.Dispose();
            }
        }
Example #5
0
        static void Main()
        {
            try
            {
                var url = "http://localhost:6156";

                Console.WriteLine("This application must run with administrator privilege.");
                Console.WriteLine("Connecting to Hermes at " + url);
                Console.WriteLine();

                // Connect to Hermes
                var client = new HermesClient(url);

                // Get or create a group that will contains all the topics
                var group = client.TryCreateGroup("Windows EventLog");

                // Create a publisher for each Event Log that this machine has
                var publishers = EventLog.GetEventLogs() // Retrieve all event logs
                    .Select(el =>
                                {
                                    // Get or create the topic for the event log
                                    var topic = group.TryCreateTopic(el.Log);

                                    // Print the topic's feed Url
                                    Console.WriteLine("Topic: {0} {1}", topic.Name, topic.GetLinkForFeed());

                                    // Create a publisher instance
                                    return new LogPublisher(el, topic);
                                })
                    .ToArray(); // Keep all publisher instances

                Console.WriteLine();
                Console.WriteLine("Connected and listening {0} event logs", publishers.Length);
                Console.WriteLine();
            }
            catch (Exception e)
            {
                // Shows any exception
                Console.WriteLine();
                Console.WriteLine(e.ToString());
            }

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
Example #6
0
        static void Main()
        {
            try
            {
                var url = "http://localhost:6156";

                Console.WriteLine("This application must run with administrator privilege.");
                Console.WriteLine("Connecting to Hermes at " + url);
                Console.WriteLine();

                // Connect to Hermes
                var client = new HermesClient(url);

                // Get or create a group that will contains all the topics
                var group = client.TryCreateGroup("Windows EventLog");

                // Create a publisher for each Event Log that this machine has
                var publishers = EventLog.GetEventLogs() // Retrieve all event logs
                                 .Select(el =>
                {
                    // Get or create the topic for the event log
                    var topic = group.TryCreateTopic(el.Log);

                    // Print the topic's feed Url
                    Console.WriteLine("Topic: {0} {1}", topic.Name, topic.GetLinkForFeed());

                    // Create a publisher instance
                    return(new LogPublisher(el, topic));
                })
                                 .ToArray(); // Keep all publisher instances

                Console.WriteLine();
                Console.WriteLine("Connected and listening {0} event logs", publishers.Length);
                Console.WriteLine();
            }
            catch (Exception e)
            {
                // Shows any exception
                Console.WriteLine();
                Console.WriteLine(e.ToString());
            }

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
Example #7
0
        private void DoMovement(string description, decimal amount)
        {
            var account = (Account)cbAccount.SelectedItem;
            var movement = new Movement
            {
                AccountId = account.Id,
                Amount = amount,
                Description = description
            };

            // Persist Movement
            Repository.Instance.Movements.Add(movement);

            // Publish Movement
            var hermes = new HermesClient();
            hermes.TryPostMessage("Decoupling Applications", "Movements", movement);

            // Refresh View
            RefreshGrid();
        }
Example #8
0
        private void DoMovement(string description, decimal amount)
        {
            var account  = (Account)cbAccount.SelectedItem;
            var movement = new Movement
            {
                AccountId   = account.Id,
                Amount      = amount,
                Description = description
            };

            // Persist Movement
            Repository.Instance.Movements.Add(movement);

            // Publish Movement
            var hermes = new HermesClient();

            hermes.TryPostMessage("Decoupling Applications", "Movements", movement);

            // Refresh View
            RefreshGrid();
        }