private static async Task ReceiveMessageAsync(Options options) { var consumer = GetSchemaConsumer(options); var validator = new SchemaValidator() .WithSchemaConsumer(consumer); var plugin = new SchemaValidatorPlugin() .WithValidator(validator); var subscription = new SubscriptionClient(options.ServiceBusConnectionString, options.Topic, options.Subscription, ReceiveMode.PeekLock); subscription.RegisterPlugin(plugin); subscription.RegisterMessageHandler(async(message, token) => { Console.WriteLine($"MessageId: {message.MessageId}, SequenceNumber: {message.SystemProperties.SequenceNumber}"); var payload = Encoding.UTF8.GetString(message.Body); Console.WriteLine(payload); await subscription.CompleteAsync(message.SystemProperties.LockToken) .ConfigureAwait(false); Console.WriteLine(MessageReceived); }, new MessageHandlerOptions(OnExceptionReceived)); await Task.CompletedTask .ConfigureAwait(false); }