Esempio n. 1
0
        /// <summary>
        /// Configures all the Azure Service Bus components.
        /// </summary>
        /// <param name="instance">The this instance.</param>
        /// <returns>A task for asynchronous programming.</returns>
        public static KunoStack UseAzureServiceBus(this KunoStack instance)
        {
            var settings = new AzureServiceBusSettings();

            instance.Configuration.GetSection("kuno:azureServiceBus")?.Bind(settings);

            instance.Use(builder =>
            {
                if (settings.EventPublisher?.TopicName != null)
                {
                    builder.RegisterModule(new TopicEventPublishingModule(settings));
                }
                if (settings.Subscriptions.Any())
                {
                    builder.RegisterModule(new TopicSubscriptionModule(settings));
                }
            });

            if (settings.Subscriptions.Any())
            {
                instance.Container.Resolve <TopicSubscription>();
            }

            return(instance);
        }
Esempio n. 2
0
        public async Task Receiver_CompletesDelivery_WhenBodyIsValid()
        {
            var       utcNow = DateTime.UtcNow;
            var       ttl    = TimeSpan.FromMinutes(5);
            IDelivery delivery;
            var       simulator = _simulation.AddServiceBus()
                                  .SetCertificate(_testCertificate)
                                  .AddQueue(TestInQueue)
                                  .Build();
            await simulator
            .StartAsync()
            .ConfigureAwait(false);

            var settings = new AzureServiceBusSettings
            {
                InConnectionString = simulator.ConnectionString,
                InQueueName        = TestInQueue
            };
            var receiver = new AzureServiceBusMessageReceiver(settings, new AzureServiceBusMessageHandler());

            using var cts = new CancellationTokenSource();
            var runTask = receiver.RunAsync(cts.Token);

            delivery = simulator.Queues[TestInQueue].Post(new Amqp.Message()
            {
                Header = new Amqp.Framing.Header
                {
                    DeliveryCount = 3,
                    Ttl           = (uint)ttl.TotalMilliseconds
                },
                BodySection = new Amqp.Framing.Data
                {
                    Binary = Encoding.ASCII.GetBytes("body1abc")
                },
                Properties = new Amqp.Framing.Properties
                {
                    MessageId     = "8457986",
                    CorrelationId = Guid.NewGuid().ToString(),
                    CreationTime  = utcNow
                },
                MessageAnnotations = new Amqp.Framing.MessageAnnotations
                {
                    [(Symbol)"x-opt-enqueue-sequence-number"] = 1234L,
                    [(Symbol)"x-opt-sequence-number"]         = 1234L,
                    [(Symbol)"x-opt-enqueued-time"]           = utcNow,
                    [(Symbol)"x-opt-locked-until"]            = utcNow.Add(ttl),
                    [(Symbol)"x-opt-scheduled-enqueue-time"]  = utcNow.AddMinutes(10),
                    [(Symbol)"x-opt-partition-id"]            = (short)17,
                    [(Symbol)"x-opt-partition-key"]           = "Key1",
                    [(Symbol)"x-opt-via-partition-key"]       = "VKey1",
                    [(Symbol)"x-opt-deadletter-source"]       = "$deadletter"
                }
            });
            var deliveryTask = delivery.WaitAsync(TimeSpan.FromSeconds(10));
            await Task.WhenAny(runTask, deliveryTask).ConfigureAwait(false);

            cts.Cancel();

            Assert.AreEqual(DeliveryResult.Completed, delivery.Result);
        }
Esempio n. 3
0
        public async Task Sender_SendsMessage()
        {
            var correlationId = Guid.NewGuid();
            var simulator     = _simulation.AddServiceBus()
                                .SetCertificate(_testCertificate)
                                .AddTopic(TestOutQueue, new[] { "sub-a", "sub-b" })
                                .Build();
            await simulator
            .StartAsync()
            .ConfigureAwait(false);

            var settings = new AzureServiceBusSettings
            {
                OutConnectionString = simulator.ConnectionString,
                OutQueueName        = TestOutQueue
            };
            var sender = new AzureServiceBusMessageSender(settings);
            await sender.SendAsync("Ehlo", correlationId);

            var delivery = simulator.Topics[TestOutQueue].Deliveries[0];
            var body     = delivery.Message.BodySection as Amqp.Framing.Data;

            Assert.AreEqual(correlationId.ToString(), delivery.Message.Properties.CorrelationId);
            Assert.AreEqual("Ehlo", Encoding.UTF8.GetString(body.Binary));
        }
        public static AzureServiceBusSettings GetSettings()
        {
            var serviceBusConnectionString = Environment.GetEnvironmentVariable(EnvironmentVariable_ServiceBusConnectionString);

            if (string.IsNullOrEmpty(serviceBusConnectionString))
            {
                throw new ApplicationException($"No Service Bus connection string found in environment variable {EnvironmentVariable_ServiceBusConnectionString}");
            }

            var blobConnectionString = Environment.GetEnvironmentVariable(EnvironmentVariable_BlobConnectionString);

            if (string.IsNullOrEmpty(blobConnectionString))
            {
                throw new ApplicationException($"No Blob connection string found in environment variable {EnvironmentVariable_BlobConnectionString}");
            }

            var settings = new AzureServiceBusSettings
            {
                ServiceBusConnectionString  = serviceBusConnectionString,
                BlobStorageConnectionString = blobConnectionString,
                BlobStorageContainerName    = "messagebodies",
                MaxDegreeOfParallelism      = 8,
                AutoComplete = false,
                ContextId    = Guid.NewGuid().ToString() // provide a unique value for each test run - this ensures that tests only consume messages intended for them and don't interfere with other tests.
            };

            return(settings);
        }
Esempio n. 5
0
        public GitHubClientTestServer()
        {
            var webhookSecret = Convert.ToBase64String(Encoding.UTF8.GetBytes("github-webhook-secret-value"));

            TestGitHubAppSettings = new GitHubAppFlavorSettings
            {
                GitHubAppsSettings = new Dictionary <string, GitHubAppSettings>
                {
                    [TestDomain] = new GitHubAppSettings
                    {
                        Id   = "23",
                        Name = "fakeName",
                        EnterpriseApiRoot = "https://fakeApiRoot",
                        EnterpriseUrl     = $"https://{TestDomain}",
                        PrivateKey        = "fakeKey",
                        WebhookSecret     = webhookSecret
                    },
                    ["github.com"] = new GitHubAppSettings
                    {
                        Id   = "23",
                        Name = "fakeName",
                        EnterpriseApiRoot = "https://fakeApiRoot",
                        EnterpriseUrl     = $"https://{TestDomain}",
                        PrivateKey        = "fakeKey",
                        WebhookSecret     = webhookSecret
                    }
                }
            };

            azureServiceBusSettings = new AzureServiceBusSettings
            {
                ConnectionString = "fakeString",
                SubscriptionName = "fakeSub",
                TopicName        = "fakeTopic"
            };
            hostBuilder = new WebHostBuilder()
                          .ConfigureServices(
                (context, services) =>
            {
                context.Configuration = new ConfigurationBuilder()
                                        .AddInMemoryObject(
                    TestGitHubAppSettings.GitHubAppsSettings[TestDomain],
                    $"{nameof(GitHubAppFlavorSettings)}:GitHubAppsSettings:{TestDomain}")
                                        .AddInMemoryObject(azureServiceBusSettings, nameof(AzureServiceBusSettings))
                                        .AddInMemoryCollection(
                    new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("ApplicationInsights:InstrumentationKey", Guid.NewGuid().ToString())
                })
                                        .Build();
                AddMockTelemetry(services);
                AddInMemoryEventBus(services);
                services.RegisterServices(context.Configuration);
            })
                          .Configure(
                (context, app) => { })
                          .UseStartup <Startup>();
            testServer = new TestServer(hostBuilder);
        }
        public static IServiceContainer GetSendOnlyContainer(AzureServiceBusSettings settings)
        {
            var result = new ServiceContainer();

            result.Register <IServiceContainer>(x => result, new PerContainerLifetime());
            result.Register <AzureServiceBusSettings>(x => settings, new PerContainerLifetime());
            result.Register <IMessageSenderFactory, MessageSenderFactory>(new PerContainerLifetime());
            return(result);
        }
Esempio n. 7
0
        public TopicSubscription(IMessageGateway messages, AzureServiceBusSettings settings)
        {
            _messages = messages;

            foreach (var subscription in settings.Subscriptions)
            {
                this.CreateClient(settings.ConnectionString, subscription.TopicName, subscription.SubscriptionName);
            }
        }
Esempio n. 8
0
        private static TopicClient CreateTopic(AzureServiceBusSettings settings)
        {
            var namespaceManager = NamespaceManager.CreateFromConnectionString(settings.ConnectionString);

            if (!namespaceManager.TopicExists(settings.EventPublisher.TopicName))
            {
                namespaceManager.CreateTopic(settings.EventPublisher.TopicName);
            }
            return(TopicClient.CreateFromConnectionString(settings.ConnectionString, settings.EventPublisher.TopicName));
        }
Esempio n. 9
0
        public EventBusServiceBusMessageListener(AzureServiceBusSettings azureServiceBusSettings,
                                                 ILogger logger, IEventBusMessageProcessor messageProcessor)
        {
            this._azureServiceBusSettings = azureServiceBusSettings;
            this._messageProcessor        = messageProcessor;
            this._logger = logger;

            this._subscriptionClient = new SubscriptionClient(_azureServiceBusSettings.ServiceBusConnectionString,
                                                              _azureServiceBusSettings.TopicName,
                                                              _azureServiceBusSettings.SubscriptionName);
        }
        static void Main(string[] args)
        {
            #region Setup Configuration
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                          .AddEnvironmentVariables();
            IConfigurationRoot configuration = builder.Build();

            var azureServiceBusSettings = new AzureServiceBusSettings();
            configuration.GetSection(nameof(AzureServiceBusSettings)).Bind(azureServiceBusSettings);

            var mongoDBSettings = new MongoDBSettings();
            configuration.GetSection(nameof(MongoDBSettings)).Bind(mongoDBSettings);

            FcmAppSettings fcmAppSettings = new FcmAppSettings();
            configuration.GetSection(nameof(FcmAppSettings)).Bind(fcmAppSettings);

            // Required by WebJobs SDK
            Environment.SetEnvironmentVariable("AzureWebJobsStorage", configuration.GetValue <string>("AzureWebJobsStorage"));
            Environment.SetEnvironmentVariable("AzureWebJobsDashboard", configuration.GetValue <string>("AzureWebJobsDashboard"));
            #endregion

            #region Setup DI
            var serviceCollection = new ServiceCollection();

            // EventBus
            serviceCollection.AddSingleton(azureServiceBusSettings);

            serviceCollection.AddSingleton <IEventBusMessageListener, EventBusServiceBusMessageListener>();
            serviceCollection.AddTransient <IEventBusMessageProcessor, OrchestratorEventBusServiceBusMessageProcessor>();
            serviceCollection.AddSingleton <IEventBusMessagePublisher, EventBusServiceBusMessagePublisher>();

            // DB
            serviceCollection.AddSingleton(mongoDBSettings);
            serviceCollection.AddSingleton <IResponseRepository, ResponseRepository>();

            // Notification
            serviceCollection.AddSingleton(fcmAppSettings);
            serviceCollection.AddSingleton <INotificationService, FcmNotificationService>();

            // Event Handlers
            // None for Notification

            var serviceProvider = serviceCollection.BuildServiceProvider();
            #endregion

            // Start listening for Events
            serviceProvider.GetService <IEventBusMessageListener>().RegisterEventListener();

            var host = new JobHost();
            host.RunAndBlock();
        }
Esempio n. 11
0
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;

            this.azureServiceBusSettings = new AzureServiceBusSettings();
            Configuration.GetSection(nameof(AzureServiceBusSettings)).Bind(azureServiceBusSettings);
            this.mongoDBSettings = new MongoDBSettings();
            Configuration.GetSection(nameof(MongoDBSettings)).Bind(mongoDBSettings);
            this.fcmAppSettings = new FcmAppSettings();
            Configuration.GetSection(nameof(FcmAppSettings)).Bind(fcmAppSettings);
            this.authenticationSettings = new AuthenticationSettings();
            Configuration.GetSection(nameof(AuthenticationSettings)).Bind(authenticationSettings);
        }
        public static IServiceContainer GetContainer(AzureServiceBusSettings settings, IMessageHandlerFactory messageHandlerFactory)
        {
            var result = new ServiceContainer();

            result.Register <IServiceContainer>(x => result, new PerContainerLifetime());
            result.Register <AzureServiceBusSettings>(x => settings, new PerContainerLifetime());
            result.Register <IMessageHandlerFactory>(x =>
            {
                return(messageHandlerFactory);
            }, new PerContainerLifetime());
            result.Register <IMessagingFactory, MessagingFactory>(new PerContainerLifetime());
            result.Register <IMessagePump, MessagePump>(new PerContainerLifetime());
            return(result);
        }
        public static async Task <IList <Message> > GetAllRawMessagesByContextId(AzureServiceBusSettings settings, string queue)
        {
            var             receiver          = new MessageReceiver(settings.ServiceBusConnectionString, queue, ReceiveMode.PeekLock);
            List <Message>  allPeekedMessages = new List <Message>();
            IList <Message> peekedMessages    = await receiver.PeekAsync(1000).ConfigureAwait(false);

            while (peekedMessages.Count > 0)
            {
                allPeekedMessages.AddRange(peekedMessages);
                peekedMessages = await receiver.PeekAsync(1000).ConfigureAwait(false);
            }

            return(allPeekedMessages.Where(x => x.UserProperties.TryGetValue(Constants.HeaderKeys.RPContextId, out var contextId) && (string)contextId == settings.ContextId).ToList());
        }
        public static bool TryGetContainer(this AzureServiceBusSettings settings, out CloudBlobContainer container)
        {
            if (CloudStorageAccount.TryParse(settings.BlobStorageConnectionString, out var storageAccount))
            {
                if (!string.IsNullOrEmpty(settings.BlobStorageContainerName))
                {
                    container = storageAccount.CreateCloudBlobClient().GetContainerReference(settings.BlobStorageContainerName);
                    return(true);
                }
            }

            container = null;
            return(false);
        }
Esempio n. 15
0
        static void Main(string[] args)
        {
            #region Setup Configuration
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                          .AddEnvironmentVariables();
            IConfigurationRoot configuration = builder.Build();

            var azureServiceBusSettings = new AzureServiceBusSettings();
            configuration.GetSection(nameof(AzureServiceBusSettings)).Bind(azureServiceBusSettings);

            var gdriveFactorySettings = new GDriveFactoryAppSettings();
            configuration.GetSection(nameof(GDriveFactoryAppSettings)).Bind(gdriveFactorySettings);

            // Required by WebJobs SDK
            Environment.SetEnvironmentVariable("AzureWebJobsStorage", configuration.GetValue <string>("AzureWebJobsStorage"));
            Environment.SetEnvironmentVariable("AzureWebJobsDashboard", configuration.GetValue <string>("AzureWebJobsDashboard"));
            #endregion

            #region Setup DI
            var serviceCollection = new ServiceCollection();

            // GDrive
            serviceCollection.AddSingleton(gdriveFactorySettings);

            // EventBus
            serviceCollection.AddSingleton(azureServiceBusSettings);
            serviceCollection.AddSingleton <IEventHandlerRegistry, InMemoryEventHandlerRegistry>();
            serviceCollection.AddSingleton <IEventBusMessageListener, EventBusServiceBusMessageListener>();
            serviceCollection.AddTransient <IEventBusMessageProcessor, DefaultEventBusServiceBusMessageProcessor>();
            serviceCollection.AddSingleton <IEventBusMessagePublisher, EventBusServiceBusMessagePublisher>();

            // Event Handlers
            serviceCollection.AddTransient <GDriveCreateProjectEventHandler>();

            var serviceProvider = serviceCollection.BuildServiceProvider();
            #endregion

            RegisterEventHandlers(serviceProvider);

            // Start listening for Events
            serviceProvider.GetService <IEventBusMessageListener>().RegisterEventListener();

            // Azure WebJobs SDK .Net Core 2.0 is in Beta with no firm release dates.
            // So, cannot use the ServiceBus Triggers part of the SDK.
            // Just using the below part of SDK code, to keep the console application running continuously.
            var host = new JobHost();
            host.RunAndBlock();
        }
        private static async Task InnerCheckRawMessagesByContextIdUntil(AzureServiceBusSettings settings, string queue, Func <IList <Message>, bool> completionCondition)
        {
            while (true)
            {
                var allMessages = await GetAllRawMessagesByContextId(settings, queue).ConfigureAwait(false);

                if (completionCondition(allMessages))
                {
                    break;
                }
                else
                {
                    await Task.Delay(1000).ConfigureAwait(false);
                }
            }
        }
Esempio n. 17
0
        public EventBusServiceBus(AzureServiceBusSettings azureServiceBusSettings, IEventHandlerRegistry eventHandlerRegistry,
                                  IServiceProvider serviceProvider, ILogger logger)
        {
            this._azureServiceBusSettings = azureServiceBusSettings;
            this._eventHandlerRegistry    = eventHandlerRegistry;
            this._serviceProvider         = serviceProvider;
            this._logger = logger;

            this._topicClient = new TopicClient(_azureServiceBusSettings.ServiceBusConnectionString,
                                                _azureServiceBusSettings.TopicName);

            // CMS Api only sends messages. So Subscription would be empty
            if (!string.IsNullOrEmpty(_azureServiceBusSettings.SubscriptionName))
            {
                this._subscriptionClient = new SubscriptionClient(_azureServiceBusSettings.ServiceBusConnectionString,
                                                                  _azureServiceBusSettings.TopicName,
                                                                  _azureServiceBusSettings.SubscriptionName);
            }
        }
Esempio n. 18
0
        public async Task Receiver_AbandonsDelivery_WhenBodyIsInvalid()
        {
            IDelivery delivery;
            var       simulator = _simulation.AddServiceBus()
                                  .SetCertificate(_testCertificate)
                                  .AddQueue(TestInQueue)
                                  .Build();
            await simulator
            .StartAsync()
            .ConfigureAwait(false);

            var settings = new AzureServiceBusSettings
            {
                InConnectionString = simulator.ConnectionString,
                InQueueName        = TestInQueue
            };
            var receiver = new AzureServiceBusMessageReceiver(settings, new AzureServiceBusMessageHandler());

            using var cts = new CancellationTokenSource();
            var runTask = receiver.RunAsync(cts.Token);

            delivery = simulator.Queues[TestInQueue].Post(new Amqp.Message()
            {
                BodySection = new Amqp.Framing.Data
                {
                    Binary = Encoding.ASCII.GetBytes("body2")
                },
                Properties = new Amqp.Framing.Properties {
                    MessageId = "54795232"
                }
            });
            var deliveryTask = delivery.WaitAsync(TimeSpan.FromSeconds(10));
            await Task.WhenAny(runTask, deliveryTask).ConfigureAwait(false);

            cts.Cancel();

            Assert.AreEqual(DeliveryResult.Abandoned, delivery.Result);
        }
Esempio n. 19
0
        static void Main(string[] args)
        {
            #region Setup Configuration
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                          .AddEnvironmentVariables();
            IConfigurationRoot configuration = builder.Build();

            var azureServiceBusSettings = new AzureServiceBusSettings();
            configuration.GetSection(nameof(AzureServiceBusSettings)).Bind(azureServiceBusSettings);

            // Required by WebJobs SDK
            Environment.SetEnvironmentVariable("AzureWebJobsStorage", "DefaultEndpointsProtocol=https;AccountName=googledocmdstorage;AccountKey=TZ8QSvCjMvY1bl5h2lSXaSCFxxjnm8jTsqEdcJCXmlNS20/wIkDriA1fLvTDMrSYu2UGGy6JzZhas2+Pn6RPPw==;EndpointSuffix=core.windows.net");
            Environment.SetEnvironmentVariable("AzureWebJobsDashboard", "DefaultEndpointsProtocol=https;AccountName=googledocmdstorage;AccountKey=TZ8QSvCjMvY1bl5h2lSXaSCFxxjnm8jTsqEdcJCXmlNS20/wIkDriA1fLvTDMrSYu2UGGy6JzZhas2+Pn6RPPw==;EndpointSuffix=core.windows.net");
            #endregion

            #region Setup DI
            var serviceCollection = new ServiceCollection();
            serviceCollection.AddSingleton <IEventHandlerRegistry, InMemoryEventHandlerRegistry>();
            serviceCollection.AddSingleton(azureServiceBusSettings);
            serviceCollection.AddSingleton <IEventBus, EventBusServiceBus>();
            serviceCollection.AddTransient <GDriveCreateProjectEventHandler>();
            var serviceProvider = serviceCollection.BuildServiceProvider();
            #endregion

            RegisterEventHandlers(serviceProvider);

            // Start listening for Events
            serviceProvider.GetService <IEventBus>().RegisterEventListener();

            // Azure WebJobs SDK .Net Core 2.0 is in Beta with no firm release dates.
            // So, cannot use the ServiceBus Triggers part of the SDK.
            // Just using the below part of SDK code, to keep the console application running continuously.
            var host = new JobHost();
            host.RunAndBlock();
        }
Esempio n. 20
0
 public TopicSubscriptionModule(AzureServiceBusSettings settings)
 {
     _settings = settings;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="IMessageService"/> class.
 /// </summary>
 /// <param name="settings"><see cref="AppSettings"/> instance.</param>
 public MessageService(AppSettings settings)
 {
     this._settings            = settings ?? throw new ArgumentNullException(nameof(settings));
     this._topicClients        = new List <ITopicClient>();
     this._subscriptionClients = new List <ISubscriptionClient>();
 }
 public AzureServiceBusFactoryConfiguratorImpl()
 {
     _settings = new AzureServiceBusSettings();
     _transportFactoryConfigurators = new List<AzureServiceBusTransportFactoryBuilderConfigurator>();
 }
 public AzureServiceBusFactoryConfiguratorImpl()
 {
     _settings = new AzureServiceBusSettings();
     _transportFactoryConfigurators = new List <AzureServiceBusTransportFactoryBuilderConfigurator>();
 }
Esempio n. 24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TopicEventPublisher" /> class.
        /// </summary>
        /// <param name="settings">The current settings.</param>
        /// <exception cref="System.ArgumentNullException">The <paramref name="settings" /> argument is null.</exception>
        public TopicEventPublisher(AzureServiceBusSettings settings)
        {
            Argument.NotNull(settings, nameof(settings));

            _topicClient = new Lazy <TopicClient>(() => CreateTopic(settings));
        }
 private TokenProvider GetTokenProvider(AzureServiceBusSettings settings)
 {
     return(TokenProvider.CreateSharedAccessSignatureTokenProvider(settings.KeyName, settings.SharedAccessKey, TokenScope.Namespace));
 }
Esempio n. 26
0
 public EventBusServiceBusMessagePublisher(AzureServiceBusSettings azureServiceBusSettings, ILogger logger)
 {
     this._topicClient = new TopicClient(_azureServiceBusSettings.ServiceBusConnectionString,
                                         _azureServiceBusSettings.TopicName);
 }
 public AzureServiceBusTransportFactoryBuilderImpl(AzureServiceBusSettings settings)
 {
     _settings = settings;
     _connectionSettingsBuilders = new Dictionary <string, ConnectionSettingsBuilder>();
 }
Esempio n. 28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TopicEventPublishingModule" /> class.
        /// </summary>
        /// <param name="settings">The current settings.</param>
        /// <exception cref="System.ArgumentNullException">The <paramref name="settings"/> argument is null.</exception>
        public TopicEventPublishingModule(AzureServiceBusSettings settings)
        {
            Argument.NotNull(settings, nameof(settings));

            _settings = settings;
        }
 public AzureServiceBusTransportFactoryBuilderImpl(AzureServiceBusSettings settings)
 {
     _settings = settings;
     _connectionSettingsBuilders = new Dictionary<string, ConnectionSettingsBuilder>();
 }
 public static async Task CheckRawMessagesByContextIdUntil(AzureServiceBusSettings settings, string queue, Func <IList <Message>, bool> completionCondition)
 {
     await AwaitWithTimeout(InnerCheckRawMessagesByContextIdUntil(settings, queue, completionCondition), 120).ConfigureAwait(false);
 }