示例#1
0
        private bool CheckBind()
        {
            bool checkResult = false;

            if (string.IsNullOrWhiteSpace(txtSelectExchange.Text))
            {
                ShowSysMessage("未选择交换机");
            }
            else if (string.IsNullOrWhiteSpace(txtSelectQueue.Text))
            {
                ShowSysMessage("未选择队列");
            }
            else
            {
                exchange = userExchanges.FirstOrDefault(x => x.name == txtSelectExchange.Text);
                queue    = queues.FirstOrDefault(x => x.name == txtSelectQueue.Text);

                if (exchange == null)
                {
                    ShowSysMessage("交换机不存在");
                }

                else if (queue == null)
                {
                    ShowSysMessage("队列不存在");
                }
                else
                {
                    checkResult = true;
                }
            }

            return(checkResult);
        }
示例#2
0
 private void btnQueue_Click(object sender, EventArgs e)
 {
     if (lbQueues.SelectedItem == null)
     {
         return;
     }
     queue = queues.FirstOrDefault(x => x.name == lbQueues.SelectedItem.ToString());
     txtSysMessage.Clear();
     if (queue != null)
     {
         ShowSysMessage(string.Format("Name:{0},\r\nState:{1},vhost:{2},Node:{3},Durable:{4},Auto_delete:{5},Memory:{6},Messages:{7},Messages_ready:{8},Messages_unacknowledged:{9},Idle_since:{10},Consumers:{11}\r\n",
                                      queue.name, queue.state, queue.vhost, queue.node, queue.durable, queue.auto_delete, queue.memory, queue.messages, queue.messages_ready, queue.messages_unacknowledged, queue.idle_since, queue.consumers));
     }
     else
     {
         ShowSysMessage("未发现该队列");
     }
 }