Exemple #1
0
        public void SpeedTest()
        {
            _bus.Subscribe("Event", _processor);

            Packet packet = new Packet()
            {
                Service = "Output",
                Command = "Print",
                Data    = "OK",
            };

            packet.Args.Add(new string[] { "arg1", "arg2" });
            packet.Options.Add(new Dictionary <string, string>()
            {
                { "opt1", "1" }, { "opt2", "2" }
            });

            //for (int i = 0; i < 5; i++)
            //{
            //    Task.Factory.StartNew(() => {
            //        var bus = new RabbitBus(new Uri("amqp://*****:*****@192.168.31.102:5672"), "Cactus.Bus");
            //        while (true)
            //        {
            //            bus.Publish("Event", packet);
            //        }
            //    });
            //}

            while (true)
            {
                _bus.Publish("Event", packet);
            }
        }
Exemple #2
0
        public void PublishTest()
        {
            Packet packet = new Packet()
            {
                Service = "Output",
                Command = "Print",
                Data    = "OK",
            };

            packet.Args.Add(new string[] { "arg1", "arg2" });
            packet.Options.Add(new Dictionary <string, string>()
            {
                { "opt1", "1" }, { "opt2", "2" }
            });

            for (int i = 0; i < 10; i++)
            {
                _bus.Publish("Event", packet);
            }
        }
Exemple #3
0
        public void SetUp()
        {
            var mockModel = new MockModel
            {
                ExchangeDeclareAction = (exchangeName, type, durable, autoDelete, arguments) => createdExchangeName = exchangeName,
                BasicPublishAction    = (exchangeName, topic, properties, messageBody) =>
                {
                    publishedToExchangeName = exchangeName;
                    publishedToTopic        = topic;
                }
            };


            var customConventions = new Conventions
            {
                ExchangeNamingConvention = x => "CustomExchangeNamingConvention",
                QueueNamingConvention    = (x, y) => "CustomQueueNamingConvention",
                TopicNamingConvention    = x => "CustomTopicNamingConvention"
            };

            CreateBus(customConventions, mockModel);
            bus.Publish(new TestMessage());
        }