예제 #1
0
        /// <summary>
        /// 删除一条消息
        /// </summary>
        /// <param name="receiptHandle"></param>
        public virtual void DeleteMessage(string receiptHandle)
        {
            SortedDictionary <string, string> param = new SortedDictionary <string, string>();

            param["queueName"]     = this.queueName;
            param["receiptHandle"] = receiptHandle;

            string result = this.client.Call("DeleteMessage", param);

            Msg.Base jsonObj = JsonConvert.DeserializeObject <Msg.Base>(result);
            if (jsonObj.Code != 0)
            {
                throw new CMQServerException(jsonObj.Code, jsonObj.Message, jsonObj.RequestId);
            }
        }
예제 #2
0
        /// <summary>
        /// 删除一个队列
        /// </summary>
        /// <param name="queueName">   String queue name </param>
        /// <exception cref="CMQClientException"> </exception>
        /// <exception cref="CMQServerException"> </exception>
        public virtual void DeleteQueue(string queueName)
        {
            SortedDictionary <string, string> param = new SortedDictionary <string, string>();

            if (queueName.Equals(""))
            {
                throw new CMQClientException("Invalid parameter:queueName is empty");
            }
            else
            {
                param["queueName"] = queueName;
            }
            string result = this.client.Call("DeleteQueue", param);

            Msg.Base jsonObj = JsonConvert.DeserializeObject <Msg.Base>(result);
            if (jsonObj.Code != 0)
            {
                throw new CMQServerException(jsonObj.Code, jsonObj.Message, jsonObj.RequestId);
            }
        }