Exemplo n.º 1
0
        /// <summary> Adds a basic consume event to <see cref="Activity"/> <paramref name="a"/> </summary>
        public static void AddBasicConsumeEvent(this Activity?a, QueueConfig cfg, string consumerTag)
        {
            if (a == null)
            {
                return;
            }

            var tags = new ActivityTagsCollection
            {
                { "queue.name", cfg.Name },
                { "queue.consumer.tag", consumerTag },
            };

            if (a.IsAllDataRequested)
            {
                tags.Add("queue.consumer.auto_ack", cfg.Consumer.AutoAck);
                tags.Add("queue.consumer.exclusive", cfg.Consumer.Exclusive);
                tags.Add("queue.consumer.no_local", cfg.Consumer.NoLocal);
                tags.AddWithPrefix("queue.consumer.args.", cfg.Consumer.Arguments);
            }

            a.AddEvent(new ActivityEvent(EventNamePrefix + "basic_consume", tags: tags));
        }
Exemplo n.º 2
0
        /// <summary> Adds a queue declared event to <see cref="Activity"/> <paramref name="a"/> </summary>
        public static void AddQueueDeclaredEvent(this Activity?a, QueueConfig cfg, QueueDeclareOk result)
        {
            if (a == null)
            {
                return;
            }

            var tags = new ActivityTagsCollection
            {
                { "queue.name", result.QueueName },
                { "queue.consumer_count", result.ConsumerCount },
                { "queue.message_count", result.MessageCount }
            };

            if (a.IsAllDataRequested)
            {
                tags.Add("queue.exclusive", cfg.Declaration.Exclusive);
                tags.Add("queue.durable", cfg.Declaration.Durable);
                tags.Add("queue.auto_delete", cfg.Declaration.AutoDelete);
                tags.AddWithPrefix("queue.args.", cfg.Declaration.Arguments);
            }
            a.AddEvent(new ActivityEvent(EventNamePrefix + "queue_declare_ok", tags: tags));
        }