Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="queue_server"></param>
        /// <param name="e"></param>
        public void Insert(QAgency queue_server, ReceiveCompletedEventArgs e)
        {
            var _queuePath = QWriter.QueuePath(queue_server);

            Publishers.Add(_queuePath, queue_server);

            if (e != null && QInsertEvents != null)
            {
                QInsertEvents(this, e);
            }
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        public void QStop()
        {
            foreach (DictionaryEntry _q in Publishers.CurrentCacheState)
            {
                CacheItem _citem = _q.Value as CacheItem;

                QAgency _agency = _citem.Value as QAgency;
                QWriter.SendSignOut(QMaster, _agency, _agency.Certkey);

                //Remove(_agency);
            }
        }
Example #3
0
        //-----------------------------------------------------------------------------------------------------------------------------
        //
        //-----------------------------------------------------------------------------------------------------------------------------
        private void Remove(QAgency queue_server, ReceiveCompletedEventArgs e)
        {
            var _queuePath = QWriter.QueuePath(queue_server);

            if (Publishers.Contains(_queuePath) == true)
            {
                Publishers.Remove(_queuePath);
            }

            if (e != null && QRemoveEvents != null)
            {
                QRemoveEvents(this, e);
            }
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="queue_server"></param>
        public void QStop(QAgency queue_server)
        {
            Guid _certkey = Certkey(queue_server);

            // I will service out using the certification key.
            if (_certkey != Guid.Empty)
            {
                QWriter.SendSignOut(QMaster, queue_server, _certkey);
            }
            else
            {
                Remove(queue_server, null);
            }
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="queue_server"></param>
        /// <returns></returns>
        public Guid Certkey(QAgency queue_server)
        {
            var _result = Guid.Empty;

            var _queuePath = QWriter.QueuePath(queue_server);

            if (Publishers.Contains(_queuePath) == true)
            {
                QAgency _agency = Publishers.GetData(_queuePath) as QAgency;
                _result = _agency.Certkey;
            }

            return(_result);
        }
Example #6
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 #7
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);
 }