public override void HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, IBasicProperties properties, ReadOnlyMemory <byte> body)
        {
            var spanBuilder = SpanBuilderHelper.BuildConsumerSpan(consumerTag, deliveryTag, exchange, routingKey, properties, _tracer);

            using (spanBuilder.StartActive(true))
            {
                base.HandleBasicDeliver(consumerTag, deliveryTag, redelivered, exchange, routingKey, properties, body);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// (Extension method) Convenience overload of BasicPublish.
        /// </summary>
        /// <remarks>
        /// The publication occurs with mandatory=false
        /// </remarks>
        public static void BasicPublish(this IModel model, string exchange, string routingKey, IBasicProperties basicProperties, ReadOnlyMemory<byte> body, ITracer tracer)
        {
            var spanBuilder = SpanBuilderHelper.BuildPublisherSpan(exchange, routingKey, basicProperties, tracer);

            using (spanBuilder.StartActive())
            {
                tracer.Inject(
                    tracer.ActiveSpan.Context,
                    BuiltinFormats.TextMap,
                    new RabbitMqTextMapInjectAdapter(basicProperties.Headers));

                model.BasicPublish(exchange, routingKey, false, basicProperties, body);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// (Spec method) Convenience overload of BasicPublish.
        /// </summary>
        public static void BasicPublish(this IModel model, string exchange, string routingKey, ITracer tracer, bool mandatory = false, IBasicProperties basicProperties = null, ReadOnlyMemory<byte> body = default)
        {
            var props = model.CreateBasicProperties();
            props.Headers = new Dictionary<string, object>();
            
            var spanBuilder = SpanBuilderHelper.BuildPublisherSpan(exchange, routingKey, props, tracer);

            using (spanBuilder.StartActive())
            {
                tracer.Inject(
                    tracer.ActiveSpan.Context,
                    BuiltinFormats.TextMap,
                    new RabbitMqTextMapInjectAdapter(props.Headers));

                model.BasicPublish(exchange, routingKey, mandatory, props, body);
            }
        }