Ejemplo n.º 1
0
 public void Resend(string machine, MessageQueueInfo queue)
 {
     //            var productionQueue = queue.Name.Replace("_error", "");
     //            var queues = MessageQueue.GetPrivateQueuesByMachine(machine);
     //            var prodQ = queues.ToList().Find(q => q.QueueName.EndsWith(productionQueue));
     //            queue.SendAll(prodQ);
 }
        /// <summary>
        /// 创建生产者
        /// </summary>
        /// <param name="messageQueueInfo">消息队列信息</param>
        /// <returns>生产者</returns>
        public IProducer CreateProducer(MessageQueueInfo messageQueueInfo)
        {
            ValidateUtil.ValidateNull(messageQueueInfo, "Rabbit消息队列信息");
            ValidateConnection();

            IProducer producer = new RabbitProducer(CreateChannel(), RabbitMessageQueueInfo.From(messageQueueInfo));

            AddClosedEventHandler(producer);

            return(producer);
        }
        /// <summary>
        /// 创建RPC服务端
        /// </summary>
        /// <param name="messageQueueInfo">消息队列信息</param>
        /// <returns>RPC服务端</returns>
        public IRpcServer CreateRpcServer(MessageQueueInfo messageQueueInfo)
        {
            ValidateUtil.ValidateNull(messageQueueInfo, "Rabbit消息队列信息");
            ValidateConnection();

            IRpcServer rpcServer = new RabbitRpcServer(CreateChannel(), RabbitMessageQueueInfo.From(messageQueueInfo));

            AddClosedEventHandler(rpcServer);

            return(rpcServer);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 将消息队列信息转换为Rabbit消息队列信息
        /// </summary>
        /// <param name="messageQueueInfo">消息队列信息</param>
        /// <returns>Rabbit消息队列信息</returns>
        public static RabbitMessageQueueInfo From(MessageQueueInfo messageQueueInfo)
        {
            if (messageQueueInfo == null)
            {
                return(null);
            }

            if (messageQueueInfo is RabbitMessageQueueInfo)
            {
                return(messageQueueInfo as RabbitMessageQueueInfo);
            }

            throw new NullReferenceException("消息队列信息不能转换为Rabbit消息队列信息");
        }