public void Should_be_able_to_set_retrypolicy() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var connectivitySettings = extensions.MessageReceivers().RetryPolicy(RetryPolicy.NoRetry); Assert.IsInstanceOf <NoRetry>(connectivitySettings.GetSettings().Get <RetryPolicy>(WellKnownConfigurationKeys.Connectivity.MessageReceivers.RetryPolicy)); }
public void Should_be_able_to_set_autorenewtimeout() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var connectivitySettings = extensions.MessageReceivers().AutoRenewTimeout(TimeSpan.FromSeconds(60)); Assert.AreEqual(TimeSpan.FromSeconds(60), connectivitySettings.GetSettings().Get <TimeSpan>(WellKnownConfigurationKeys.Connectivity.MessageReceivers.AutoRenewTimeout)); }
public void Should_be_able_to_set_prefetchcount() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var connectivitySettings = extensions.MessageReceivers().PrefetchCount(1000); Assert.AreEqual(1000, connectivitySettings.GetSettings().Get <int>(WellKnownConfigurationKeys.Connectivity.MessageReceivers.PrefetchCount)); }
public void Should_be_able_to_set_receivemode() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var connectivitySettings = extensions.MessageReceivers().ReceiveMode(ReceiveMode.ReceiveAndDelete); Assert.AreEqual(ReceiveMode.ReceiveAndDelete, connectivitySettings.GetSettings().Get <ReceiveMode>(WellKnownConfigurationKeys.Connectivity.MessageReceivers.ReceiveMode)); }
public static void ConfigureTransport(this TransportExtensions <AzureServiceBusTransport> transport, TransportSettings transportSettings) { transport.Transactions(TransportTransactionMode.SendsAtomicWithReceive); transport.ConnectionString(transportSettings.ConnectionString); transport.MessageReceivers().PrefetchCount(0); transport.Queues().LockDuration(TimeSpan.FromMinutes(5)); transport.Subscriptions().LockDuration(TimeSpan.FromMinutes(5)); transport.MessagingFactories().NumberOfMessagingFactoriesPerNamespace(2); transport.NumberOfClientsPerEntity(Math.Min(Environment.ProcessorCount, transportSettings.MaxConcurrency)); }
public static void ConfigureTransport(this TransportExtensions <AzureServiceBusTransport> transport, TransportSettings transportSettings) { //If the custom part stays in the connection string and is at the end, the sdk will treat is as part of the SharedAccessKey var connectionString = ConnectionStringPartRemover.Remove(transportSettings.ConnectionString, QueueLengthProvider.QueueLengthQueryIntervalPartName); transport.ConnectionString(connectionString); transport.Transactions(TransportTransactionMode.SendsAtomicWithReceive); transport.MessageReceivers().PrefetchCount(0); transport.Queues().LockDuration(TimeSpan.FromMinutes(5)); transport.Subscriptions().LockDuration(TimeSpan.FromMinutes(5)); transport.MessagingFactories().NumberOfMessagingFactoriesPerNamespace(2); transport.NumberOfClientsPerEntity(Math.Min(Environment.ProcessorCount, transportSettings.MaxConcurrency)); }
public async Task Applies_user_defined_connectivity_settings() { var settings = DefaultConfigurationValues.Apply(SettingsHolderFactory.BuildWithSerializer()); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); extensions.MessageReceivers() .PrefetchCount(1000) .RetryPolicy(RetryPolicy.NoRetry) .ReceiveMode(ReceiveMode.ReceiveAndDelete); var factory = new InterceptedMessagingFactory(); var creator = new MessageReceiverCreator(new InterceptedMessagingFactoryFactory(factory), settings); var receiver = await creator.Create("myqueue", AzureServiceBusConnectionString.Value); Assert.AreEqual(ReceiveMode.ReceiveAndDelete, receiver.Mode); Assert.IsInstanceOf <NoRetry>(receiver.RetryPolicy); Assert.AreEqual(1000, receiver.PrefetchCount); }