Example #1
0
 public void Enqueue(string topic, string data)
 {
     if (!_dic.TryGetValue(topic, out QueueBase queue))
     {
         queue = new QueueBase(topic);
         _dic.TryAdd(topic, queue);
     }
     queue.Enqueue(data);
 }
Example #2
0
        public void Enqueue(string topic, string data)
        {
            var queue = _list.Values.FirstOrDefault(b => b.Topic.Equals(topic));

            lock (_syncLocker)
            {
                if (queue == null)
                {
                    queue = new QueueBase(topic);
                    _list.TryAdd(topic, queue);
                }
            }
            queue.Enqueue(data);
        }