Exemplo n.º 1
0
        public void WorkMessageSenderTest()
        {
            MessageSender sender = new MessageSender(GggUtilities.ExchangeDefault, GggUtilities.QueueHello);

            sender.SendMulti(100);
            GggUtilities.ShowLog();
        }
Exemplo n.º 2
0
        public void DeclareQueueTest()
        {
            string declareQueue = GggRabbitMq.DeclareQueue();

            GggUtilities.WriteLog(this, "declareQueue: " + declareQueue);
            GggUtilities.ShowLog();
        }
Exemplo n.º 3
0
        public void PublishToExchangeTest()
        {
            MessageSender sender = new MessageSender(GggUtilities.ExchangeLogs, GggUtilities.QueueHello);

            sender.SendMulti(5);
            GggUtilities.ShowLog();
        }
Exemplo n.º 4
0
        public void MessageDurabilitySendTest()
        {
            // sent
            MessageSender sender = new MessageSender(GggUtilities.QueueDurable, null,
                                                     autoDelete: false, exclusive: false,
                                                     isDurable: true,
                                                     routingKey: GggUtilities.QueueDurable);

            sender.SendMulti(10);
            GggUtilities.ShowLog();
        }
Exemplo n.º 5
0
        public void PublishAndReceiveWorkerTestTrueAct()
        {
            double seconds  = 3;
            double waitTime = TimeSpan.FromSeconds(seconds).TotalMilliseconds;
            // send
            MessageSender sender = new MessageSender(GggUtilities.ExchangeDefault, GggUtilities.QueueHello);

            sender.SendMulti(10);
            // receive
            Debug.WriteLine("Waiting {0} seconds before receive.", seconds);
            System.Threading.Thread.Sleep((int)waitTime);
            MessageReceiver receiver = new MessageReceiver("receiver1", GggUtilities.QueueTaskQueue);

            receiver.Receive();
            Debug.WriteLine("Waiting {0} seconds for thread to finish.", seconds);
            System.Threading.Thread.Sleep((int)waitTime);
            GggUtilities.ShowLog();
        }
Exemplo n.º 6
0
        public void RoundRobinSample()
        {
            double seconds  = 3;
            double waitTime = TimeSpan.FromSeconds(seconds).TotalMilliseconds;
            // set receivers
            MessageReceiver receiver1 = new MessageReceiver("receiver1", GggUtilities.QueueHello);
            MessageReceiver receiver2 = new MessageReceiver("receiver2", GggUtilities.QueueHello);

            receiver1.Receive();
            receiver2.Receive();
            // send messages
            MessageSender sender = new MessageSender(GggUtilities.ExchangeDefault, GggUtilities.QueueHello);

            sender.SendMulti(100);
            // wait
            Debug.WriteLine("Waiting {0} seconds for thread to finish.", seconds);
            System.Threading.Thread.Sleep((int)waitTime);
            GggUtilities.ShowLog();
        }
Exemplo n.º 7
0
        public void PublishAndReceiveWorkerTestFalseAct()
        {
            double seconds  = 3;
            double waitTime = TimeSpan.FromSeconds(seconds).TotalMilliseconds;
            // send
            MessageSender sender = new MessageSender(GggUtilities.ExchangeDefault, GggUtilities.QueueHello);

            sender.SendMulti(10);
            // receive
            Debug.WriteLine("Waiting {0} seconds before receive.", seconds);
            System.Threading.Thread.Sleep((int)waitTime);
            MessageReceiver receiver = new MessageReceiver("receiver1", GggUtilities.QueueTaskQueue, arguments: null,
                                                           autoDelete: false, exclusive: false, isDurable: false,
                                                           basicQosEnabled: false, autoAck: false);

            receiver.Receive();
            Debug.WriteLine("Waiting {0} seconds for thread to finish.", seconds);
            System.Threading.Thread.Sleep((int)waitTime);
            GggUtilities.ShowLog();
        }
Exemplo n.º 8
0
        public void PublishReadExchangeTest()
        {
            // timers
            double seconds  = 3;
            double waitTime = TimeSpan.FromSeconds(seconds).TotalMilliseconds;
            // sent
            MessageSender sender = new MessageSender(GggUtilities.ExchangeLogs, GggUtilities.QueueHello);

            sender.SendMulti(5);
            // wait
            GggUtilities.WriteLog(this, "Waiting {0} seconds before receiver.".Replace("{0}", seconds.ToString()));
            System.Threading.Thread.Sleep((int)waitTime);
            // receiver
            MessageReceiver receiver = new MessageReceiver("receiver1", GggUtilities.QueueHello);

            receiver.Receive();
            // wait
            GggUtilities.WriteLog(this, "Waiting {0} seconds for thread to finish.".Replace("{0}", seconds.ToString()));
            System.Threading.Thread.Sleep((int)waitTime);
            GggUtilities.ShowLog();
        }
Exemplo n.º 9
0
        public void MessageDurabilityTest()
        {
            // timers
            double seconds  = 3;
            double waitTime = TimeSpan.FromSeconds(seconds).TotalMilliseconds;
            // sent
            MessageSender sender = new MessageSender(GggUtilities.QueueDurable, null,
                                                     autoDelete: false, exclusive: false, isDurable: true,
                                                     routingKey: GggUtilities.QueueDurable);

            sender.SendMulti(10);
            // wait
            GggUtilities.WriteLog(this, "Waiting {0} seconds before receiver.".Replace("{0}", seconds.ToString()));
            System.Threading.Thread.Sleep((int)waitTime);
            // receiver
            MessageReceiver receiver = new MessageReceiver("receiver1", GggUtilities.QueueDurable, null, autoDelete: false, exclusive: false, isDurable: true);

            receiver.Receive();
            // wait
            GggUtilities.WriteLog(this, "Waiting {0} seconds for thread to finish.".Replace("{0}", seconds.ToString()));
            System.Threading.Thread.Sleep((int)waitTime);
            GggUtilities.ShowLog();
        }
Exemplo n.º 10
0
 public void DeclareExchangeTest()
 {
     GggRabbitMq.DeclareExchange(exchange: GggUtilities.ExchangeLogs, type: "fanout");
     GggUtilities.ShowLog();
 }
Exemplo n.º 11
0
 public void BindQueueTest()
 {
     GggRabbitMq.BindQueue(GggUtilities.ExchangeLogs, GggUtilities.QueueHello);
     GggUtilities.ShowLog();
 }