Exemple #1
0
        public override void Subscribe(EventDeclare eventDeclare)
        {
            var ed = eventDeclare;

            if (ed.IsCopy)
            {
                return;
            }
            var thread = new Core.ThreadWork()
            {
                Args = ed
            };

            thread.Start(ed.Name, SubscribeData, ed.ThreadSleepSecond);
            threads.Add(thread);
        }
Exemple #2
0
        public override void Subscribe(EventDeclare eventDeclare)
        {
            var queueName = _queueConfig.QueueName;

            if (!string.IsNullOrEmpty(eventDeclare.QueueName))
            {
                queueName = eventDeclare.QueueName;
            }
            var routingKey = eventDeclare.Name;

            if (eventDeclare.IsCopy)
            {
                routingKey = eventDeclare.GetArrayName();
            }
            client.Subscribe(routingKey, OnReceiveString);
        }
Exemple #3
0
        public override void SubscribeAsync(EventDeclare eventDeclare)
        {
            var queueName = _queueConfig.QueueName;

            if (!string.IsNullOrEmpty(eventDeclare.QueueName))
            {
                queueName = eventDeclare.QueueName;
            }
            var routingKey = eventDeclare.Name;

            if (eventDeclare.IsCopy)
            {
                routingKey = eventDeclare.GetArrayName();
            }
            //异步订阅
            client.BeginReceiveAsync(queueName, routingKey, OnReceiveAsync);
        }
Exemple #4
0
        public override void SubscribeAsync(EventDeclare eventDeclare)
        {
            var ed = eventDeclare;

            if (ed.IsCopy)
            {
                return;
            }
            var thread = new Core.ThreadWork()
            {
                Args = ed
            };

            thread.Start(ed.Name, (args) =>
            {
                SubscribeDataSync(args).Wait();
                return(true);
            }, ed.ThreadSleepSecond);
            threads.Add(thread);
        }
Exemple #5
0
 public abstract void SubscribeAsync(EventDeclare eventDeclare);