Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Potential issue using the IEnumerable overload of EnqueueAsync #22

Open
jdtaylor91 opened this issue Feb 20, 2019 · 0 comments
Open

Potential issue using the IEnumerable overload of EnqueueAsync #22

jdtaylor91 opened this issue Feb 20, 2019 · 0 comments

Comments

@jdtaylor91
Copy link
Member

jdtaylor91 commented Feb 20, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant