Ejemplo n.º 1
0
        public IModel GetChannel()
        {
            if (currConnection == null)
            {
                currConnection = GetConnection();
            }
            else if (!currConnection.IsOpen)
            {
                connectionStatus.OnBuildConnError("MQ连接已经断开");
                return(null);
            }

            IModel channel = null;

            try
            {
                channel = currConnection.CreateModel();
            }
            catch (Exception e)
            {
                connectionStatus.OnBuildChannelError(e.Message);
            }
            return(channel);
        }