Potential issue using the IEnumerable overload of EnqueueAsync #22
Description
The EnqueueAsync
method has overloads that support sending an IEnumerable<T>
as well as sending a single object of type T
.
If the calling code sends a List<T>
instead of an IEnumerable<T>
, the wrong overload will be picked and the queuing abstraction will send a single message with the serialized list within it, whereas the intent is for a batch of many messages to be sent.
We should see how we can improve the API to avoid this issue occurring.
The Azure Service Bus MessageSender
implementation includes an overload that uses IList<T>
instead of IEnumerable<T>
, it may be that this is a nicer overload. Alternatively, we may need to introduce a new method, EnqueueBatchAsync
, instead of adding overloads of EnqueueAsync
.
Test should be added to ensure the correct method is called when types of IEnumerable<T>
and ICollection<T>
are passed into the EnqueueAsync
or EnqueueBatchAsync
methods.
Activity