예제 #1
0
        private static void SendDelayMsg()
        {
            RabbitmqConfigOptions rabbitmqOption = new RabbitmqConfigOptions();
            string           queueName           = "test_delayqueues";
            RabbitMQProducer producer            = new RabbitMQProducer(rabbitmqOption);

            producer.Open();
            for (int i = 0; i < 500; i++)
            {
                //producer.SendDelayQueues("这是延迟消息" + i.ToString(), queueName, (double)(10000 + i * 1000), "beDeadLetter_");
                var isPublished = producer.SendDelayQueuesWithConfirmSelect("这是延迟消息" + i.ToString(), queueName, (double)(10000 + i * 1000), "beDeadLetter_");
                Console.WriteLine($"发送{(isPublished?"成功":"失败")}");
            }
            producer.Close();
        }
예제 #2
0
        private static void SendMsg()
        {
            RabbitmqConfigOptions rabbitmqOption = new RabbitmqConfigOptions();
            var queueName = "queue_test_workqueues";
            //var queueName = "test_delayqueues";
            RabbitMQProducer producer = new RabbitMQProducer(rabbitmqOption);

            producer.Open();
            for (int i = 0; i < 500; i++)
            {
                //producer.SendWorkQueues("这是工作队列消息" + i.ToString(), queueName);
                var isPublished = producer.SendWorkQueuesWithConfirmSelect("这是工作队列消息" + i.ToString(), queueName);
                Console.WriteLine($"发送{(isPublished?"成功":"失败")}");
            }
            producer.Close();
        }