Example #1
0
        /// <summary>
        /// Finds the original message for the given response, pulls it out of the store, stops the response timeout
        /// and returns the client defined event data
        /// </summary>
        /// <param name="responseMessageType">The expected response message type the stored message. I.e. PubAck, SubAck, etc.</param>
        /// <param name="messageId">The expected response message ID the stored message.</param>
        /// <param name="clientUid">The connection context.</param>
        /// <returns></returns>
        public object Remove(MessageType responseMessageType, int messageId, string clientUid)
        {
            if (responseMessageType == MessageType.None)
            {
                return(null);
            }

            lock (_lock)
            {
                int index = FindMessageIndex(responseMessageType, messageId, clientUid);
                if (index >= 0)
                {
                    var data = (MessageStoreData)_pendingMessageData.GetAt(index);
                    data.ResponseTimer.Stop();
                    _pendingMessageData.RemoveAt(index);
                    return(data.EventData);
                }
                return(null);
            }
        }
        private void ReadPayload()
        {
            lock (_msg.SyncLock)
            {
                if (!_msg.PayloadRead)
                {
                    int pos = ReadVariableHeader();

                    var nameArray = new AutoExpandingArray();
                    while (pos < _msg.MsgBuffer.Length)
                    {
                        string topicName = Frame.DecodeString(_msg.MsgBuffer, ref pos);
                        nameArray.Add(topicName);
                    }

                    _topicNames = new string[nameArray.Count];
                    for (int i = 0; i < nameArray.Count; i++)
                    {
                        _topicNames[i] = (string)nameArray.GetAt(i);
                    }

                    _msg.PayloadRead = true;
                }
            }
        }
Example #3
0
 public QualityOfService GetAt(int index)
 {
     return((QualityOfService)_list.GetAt(index));
 }
 public SubscriptionItem GetAt(int index)
 {
     return((SubscriptionItem)_list.GetAt(index));
 }