diff --git a/src/Messaging/NBB.Messaging.Host/MessagingPipeline/SchemaMessageValidatorMiddleware.cs b/src/Messaging/NBB.Messaging.Host/MessagingPipeline/SchemaMessageValidatorMiddleware.cs index 491fbf27..4a767c2a 100644 --- a/src/Messaging/NBB.Messaging.Host/MessagingPipeline/SchemaMessageValidatorMiddleware.cs +++ b/src/Messaging/NBB.Messaging.Host/MessagingPipeline/SchemaMessageValidatorMiddleware.cs @@ -19,21 +19,9 @@ public class SchemaMessageValidatorMiddleware : IPipelineMiddleware next) { - if (!context.MessagingEnvelope.Headers.TryGetValue(MessagingHeaders.MessageType, out var _)) - throw new Exception($"Message of type {context.MessagingEnvelope.Payload.GetType().GetPrettyName()} does not contain {MessagingHeaders.MessageType} header."); - if (!context.MessagingEnvelope.Headers.TryGetValue(MessagingHeaders.CorrelationId, out var _)) throw new Exception($"Message of type {context.MessagingEnvelope.Payload.GetType().GetPrettyName()} does not contain {MessagingHeaders.CorrelationId} header."); - if (!context.MessagingEnvelope.Headers.TryGetValue(MessagingHeaders.MessageId, out var _)) - throw new Exception($"Message of type {context.MessagingEnvelope.Payload.GetType().GetPrettyName()} does not contain {MessagingHeaders.MessageId} header."); - - if (!context.MessagingEnvelope.Headers.TryGetValue(MessagingHeaders.PublishTime, out var _)) - throw new Exception($"Message of type {context.MessagingEnvelope.Payload.GetType().GetPrettyName()} does not contain {MessagingHeaders.PublishTime} header."); - - if (!context.MessagingEnvelope.Headers.TryGetValue(MessagingHeaders.StreamId, out var _)) - throw new Exception($"Message of type {context.MessagingEnvelope.Payload.GetType().GetPrettyName()} does not contain {MessagingHeaders.StreamId} header."); - if (!context.MessagingEnvelope.Headers.TryGetValue(MessagingHeaders.Source, out var _)) throw new Exception($"Message of type {context.MessagingEnvelope.Payload.GetType().GetPrettyName()} does not contain {MessagingHeaders.Source} header.");