Example #1
0
        //-----------------------------------------------------------------------------------------------------------------------------
        //
        //-----------------------------------------------------------------------------------------------------------------------------
        private void Subscriber_QRecveiveEvent(object sender, ReceiveCompletedEventArgs e)
        {
            var _qmessage = e.Message.Body as QMessage;

            if (e.Message.Label == "CMD")         // command
            {
                var _product = _qmessage.ProductId;
                var _command = _qmessage.Command.ToLower();

                var _message = _qmessage.Message;
                if (_qmessage.UsePackage == true)
                {
                    _message = Serialization.SNG.ReadPackage <string>(_qmessage.Package);
                }

                if (_product != QMaster.ProductId)
                {
                    if (_command == "ping")
                    {
                        QWriter.SendPong(QMaster, _qmessage, _message);
                    }
                    else if (_command == "certkey")
                    {
                        _qmessage.Certkey = new Guid(_message);
                        Insert(_qmessage, e);
                    }
                    else if (_command == "remove")
                    {
                        Remove(_qmessage, e);
                    }
                    else if (_command == "reset")
                    {
                        Remove(_qmessage, e);

                        if (String.Compare(_qmessage.IssuedHost, QMaster.IssuedHost, true) == 0)
                        {
                            QWriter.SendSignIn(QMaster, _qmessage, _message);
                        }
                    }
                }
            }

            if (QReadEvents != null)
            {
                QReadEvents(this, e);
            }
        }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="queue_server"></param>
 /// <param name="args"></param>
 /// <param name="open_with_purge"></param>
 public void QStart(QAgency queue_server, string args, bool open_with_purge)
 {
     QStart(open_with_purge);
     QWriter.SendSignIn(QMaster, queue_server, args);
 }