public override async Task Enrich(IReadOnlyDictionary <string, string> headers, IDictionary <string, object> metadata)
            {
                var sendingEndpoint = EndpointDetailsParser.SendingEndpoint(headers);

                // SendingEndpoint will be null for messages that are from v3.3.x endpoints because we don't
                // have the relevant information via the headers, which were added in v4.
                if (sendingEndpoint != null)
                {
                    await TryAddEndpoint(sendingEndpoint)
                    .ConfigureAwait(false);

                    metadata.Add("SendingEndpoint", sendingEndpoint);
                }

                var receivingEndpoint = EndpointDetailsParser.ReceivingEndpoint(headers);

                // The ReceivingEndpoint will be null for messages from v3.3.x endpoints that were successfully
                // processed because we dont have the information from the relevant headers.
                if (receivingEndpoint != null)
                {
                    metadata.Add("ReceivingEndpoint", receivingEndpoint);
                    await TryAddEndpoint(receivingEndpoint)
                    .ConfigureAwait(false);
                }
            }
Esempio n. 2
0
        public static EndpointInstanceId From(IReadOnlyDictionary <string, string> headers)
        {
            var details = EndpointDetailsParser.ReceivingEndpoint(headers);

            string instanceId;

            headers.TryGetValue("NServiceBus.Metric.InstanceId", out instanceId);

            return(new EndpointInstanceId(details.Name, instanceId ?? details.HostId.ToString("N"), details.Host));
        }
        static string ExtractInstanceId(IReadOnlyDictionary <string, string> headers)
        {
            if (headers.TryGetValue("NServiceBus.Metric.InstanceId", out var instanceId))
            {
                return(instanceId);
            }

            var details = EndpointDetailsParser.ReceivingEndpoint(headers);

            return(details?.HostId.ToString("N"));
        }
Esempio n. 4
0
            public override void Enrich(IReadOnlyDictionary <string, string> headers, IDictionary <string, object> metadata)
            {
                var status   = GetLicenseStatus(headers);
                var endpoint = EndpointDetailsParser.ReceivingEndpoint(headers);

                // The ReceivingEndpoint will be null for messages from v3.3.x endpoints that were successfully
                // processed because we dont have the information from the relevant headers.
                if (endpoint != null)
                {
                    licenseStatusKeeper.Set(endpoint.Name + endpoint.Host, status);
                }
            }
        public override void Enrich(ImportMessage message)
        {
            var status   = GetLicenseStatus(message.PhysicalMessage.Headers);
            var endpoint = EndpointDetailsParser.ReceivingEndpoint(message.PhysicalMessage.Headers);

            // The ReceivingEndpoint will be null for messages from v3.3.x endpoints that were successfully
            // processed because we dont have the information from the relevant headers.
            if (endpoint != null)
            {
                LicenseStatusKeeper.Set(endpoint.Name + endpoint.Host, status);
            }
        }
            public override void Enrich(IReadOnlyDictionary <string, string> headers, IDictionary <string, object> metadata)
            {
                var sendingEndpoint = EndpointDetailsParser.SendingEndpoint(headers);

                // SendingEndpoint will be null for messages that are from v3.3.x endpoints because we don't
                // have the relevant information via the headers, which were added in v4.
                if (sendingEndpoint != null)
                {
                    TryAddEndpoint(sendingEndpoint);
                }

                var receivingEndpoint = EndpointDetailsParser.ReceivingEndpoint(headers);

                TryAddEndpoint(receivingEndpoint);
            }
Esempio n. 7
0
        public override void Enrich(ImportMessage message)
        {
            var sendingEndpoint = EndpointDetailsParser.SendingEndpoint(message.PhysicalMessage.Headers);

            // SendingEndpoint will be null for messages that are from v3.3.x endpoints because we don't
            // have the relevant information via the headers, which were added in v4.
            if (sendingEndpoint != null)
            {
                TryAddEndpoint(sendingEndpoint);
            }

            var receivingEndpoint = EndpointDetailsParser.ReceivingEndpoint(message.PhysicalMessage.Headers);

            TryAddEndpoint(receivingEndpoint);
        }
Esempio n. 8
0
        public override void Enrich(ImportMessage message)
        {
            var sendingEndpoint = EndpointDetailsParser.SendingEndpoint(message.PhysicalMessage.Headers);

            // SendingEndpoint will be null for messages that are from v3.3.x endpoints because we don't
            // have the relevant information via the headers, which were added in v4.
            if (sendingEndpoint != null)
            {
                message.Metadata.Add("SendingEndpoint", sendingEndpoint);
            }

            var receivingEndpoint = EndpointDetailsParser.ReceivingEndpoint(message.PhysicalMessage.Headers);

            // The ReceivingEndpoint will be null for messages from v3.3.x endpoints that were successfully
            // processed because we dont have the information from the relevant headers.
            if (receivingEndpoint != null)
            {
                message.Metadata.Add("ReceivingEndpoint", receivingEndpoint);
            }
        }
Esempio n. 9
0
        static string ExtractEndpointName(IReadOnlyDictionary <string, string> headers)
        {
            var details = EndpointDetailsParser.ReceivingEndpoint(headers);

            return(details?.Name);
        }