public static void AddReceiveContextHeaders(this StartedActivity?startedActivity, ReceiveContext context) { if (!startedActivity.HasValue) { return; } var activity = startedActivity.Value; activity.AddTag(DiagnosticHeaders.InputAddress, context.InputAddress); if (context.TransportHeaders.TryGetHeader("MessageId", out var messageIdHeader) && messageIdHeader != null) { activity.AddTag(DiagnosticHeaders.MessageId, messageIdHeader.ToString()); } context.AddOrUpdatePayload <StartedActivityContext>(() => activity, _ => activity); }