diff --git a/src/Paramore.Brighter.MessagingGateway.AzureServiceBus/AzureServiceBusProducerRegistryFactory.cs b/src/Paramore.Brighter.MessagingGateway.AzureServiceBus/AzureServiceBusProducerRegistryFactory.cs index a76a3731c3..d3228f3aa1 100644 --- a/src/Paramore.Brighter.MessagingGateway.AzureServiceBus/AzureServiceBusProducerRegistryFactory.cs +++ b/src/Paramore.Brighter.MessagingGateway.AzureServiceBus/AzureServiceBusProducerRegistryFactory.cs @@ -7,11 +7,12 @@ public class AzureServiceBusProducerRegistryFactory : IAmAProducerRegistryFactor { private readonly IServiceBusClientProvider _clientProvider; private readonly IEnumerable _asbPublications; + private readonly int _bulkSendBatchSize; /// /// Creates a producer registry initialized with producers for ASB derived from the publications /// - /// The configuration of the connection to AWS + /// The configuration of the connection to ASB /// A set of publications - topics on the server - to configure public AzureServiceBusProducerRegistryFactory( AzureServiceBusConfiguration configuration, @@ -19,19 +20,23 @@ public AzureServiceBusProducerRegistryFactory( { _clientProvider = new ServiceBusConnectionStringClientProvider(configuration.ConnectionString); _asbPublications = asbPublications; + _bulkSendBatchSize = configuration.BulkSendBatchSize; } /// /// Creates a producer registry initialized with producers for ASB derived from the publications /// - /// The connection to AWS + /// The connection to ASB /// A set of publications - topics on the server - to configure + /// The maximum size to chunk messages when dispatching to ASB public AzureServiceBusProducerRegistryFactory( IServiceBusClientProvider clientProvider, - IEnumerable asbPublications) + IEnumerable asbPublications, + int bulkSendBatchSize = 10) { _clientProvider = clientProvider; _asbPublications = asbPublications; + _bulkSendBatchSize = bulkSendBatchSize; } @@ -44,7 +49,7 @@ public IAmAProducerRegistry Create() var producers = new Dictionary(); foreach (var publication in _asbPublications) { - producers[publication.Topic] = AzureServiceBusMessageProducerFactory.Get(_clientProvider, publication);; + producers[publication.Topic] = AzureServiceBusMessageProducerFactory.Get(_clientProvider, publication, _bulkSendBatchSize); } return new ProducerRegistry(producers); diff --git a/src/Paramore.Brighter/IAmAProducerRegistryFactory.cs b/src/Paramore.Brighter/IAmAProducerRegistryFactory.cs index a48739bb05..a304074fb4 100644 --- a/src/Paramore.Brighter/IAmAProducerRegistryFactory.cs +++ b/src/Paramore.Brighter/IAmAProducerRegistryFactory.cs @@ -1,4 +1,4 @@ -#region Licence +#region Licence /* The MIT License (MIT) Copyright © 2015 Toby Henderson