Ejemplo n.º 1
0
        public MQChannel CreateChannel(string queue, string routeKey, string exchangeType)
        {
            MQConnection     conn    = new MQConnection(this.Config, this.vHost);
            MQChannelManager cm      = new MQChannelManager(conn);
            MQChannel        channel = cm.CreateReceiveChannel(exchangeType, this.Exchange, queue, routeKey);

            return(channel);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  启动订阅
        /// </summary>
        public void Start()
        {
            if (started)
            {
                return;
            }

            MQConnection     conn    = new MQConnection(this.Config, this.vHost);
            MQChannelManager manager = new MQChannelManager(conn);

            foreach (var item in this.Queues)
            {
                MQChannel channel = manager.CreateReceiveChannel(item.ExchangeType, this.Exchange, item.Queue, item.RouterKey);
                channel.OnReceivedCallback = item.OnReceived;
                this.Channels.Add(channel);
            }
            started = true;
        }