Exemplo n.º 1
0
        private static void Main()
        {
            Console.WriteLine("Sender");

            Producer producer = new Producer(ChannelConfiguration.Name);
            producer.Send("Hello World");

            ConsolePause.PauseForInput();
        }
Exemplo n.º 2
0
        private static void Main()
        {
            Console.WriteLine("Sender");
            Producer producer = new Producer(ChannelConfiguration.Name);

            while (true)
            {
                string message = SenderUtil.GetInput("message");
                producer.Send(message);
            }
        }
Exemplo n.º 3
0
        private static void Main()
        {
            Console.WriteLine("Sender");
            Producer producer = new Producer(ChannelConfiguration.Name);

            while (true)
            {
                string topic = SenderUtil.GetInput("topic");
                string message = SenderUtil.GetInput("message");
                Message msg = new Message(message) {Extension = Convert.FromBase64String(topic)};
                producer.Send(msg);
            }
        }
Exemplo n.º 4
0
        //sender -c=hello_world
        static void Main(string[] args)
        {
            string channel = string.Empty;
            var p = new OptionSet() {{"c|channel=", "The name of the channel that we should send messages to", c => channel = c}};
            p.Parse(args);
            if (string.IsNullOrEmpty(channel))
            {
                Console.WriteLine("You must provide a channel name");
                return;
            }

            string channelName = string.Format(@".\private$\{0}", channel);

            var producer = new Producer(channelName);
            producer.Send("Hello World");
        }
Exemplo n.º 5
0
        //sender -m="my name is" -t=Greeting
        static void Main(string[] args)
        {
            var topic = string.Empty;
            var message = string.Empty;
            var p = new OptionSet()
                        {
                            {"t|topic=", t => topic = t},
                            {"m|message=", m => message = m}
                        };
            p.Parse(args);

            if (CheckArguments(message, topic))
            {
                return;
            }

            var producer = new Producer(ConfigurationSettings.OutBoundChannel);
            var msg = new Message(message) {Extension = Encoding.ASCII.GetBytes(topic)};
            producer.Send(msg);
        }
Exemplo n.º 6
0
        private static void Send(object startParam)
        {
            var message = new Message
            {
                Title = "title",
                Body = "Body"
            };

            using (var sender = new Producer<Message>("localhost", string.Empty, "add", routing))
            {
                var token = (CancellationToken)startParam;
                var random = new Random(DateTime.Now.Millisecond);
                while (!token.IsCancellationRequested)
                {
                    message.Complexity = random.Next(10);
                    sender.Send(message);
                    Thread.Sleep(1000);
                }
            }
        }
Exemplo n.º 7
0
        private static void Main()
        {
            Console.WriteLine("Sender");

            // Create an instance of the producer to send to the broker via the outbound channel
            Producer producer = new Producer(ChannelConfiguration.Name);

            while (true)
            {
                string topic = SenderUtil.GetInput("topic");
                string message = SenderUtil.GetInput("message");

                // Create a message from the input and set its Extension property from the topic
                byte[] bytes = Encoding.Unicode.GetBytes(topic);
                Message mess = new Message(message) {Extension = bytes};

                // Send the message
                producer.Send(mess);
            }
        }
Exemplo n.º 8
0
        //sender -m="my name is" -c=polling_consumer
        static void Main(string[] args)
        {
            var channel = string.Empty;
            var message = string.Empty;
            var p = new OptionSet()
                        {
                            {"c|channel=", v => channel = v},
                            {"m|message=", m => message = m}
                        };
            p.Parse(args);

            if (CheckArguments(message, channel))
            {
                return;
            }

            string channelName = string.Format(@".\private$\{0}", channel);

            var producer = new Producer(channelName);
            producer.Send(message);
        }