The BatchReceiveMessage interface can be used to receive up to 16 messages at a time.

But why BatchReceiveMessage can only receive five messages when there are ten messages?

Here is the test: Ten messages in a queue are sent in sequence (m1, m2, m3, m4, m5, m6, m7, m8, m9 and m10). The first call of BatchReceiveMessage consumes five messages (m2, m4, m6, m8 and m10), and the second call of BatchReceiveMessage consumes the remaining five messages (m1, m3, m5, m7 and m9).

The Message Service stores data in multiple slices and fetches data only from one slice at each batch fetch operation. After fetching the required data, the Message Service immediately returns, instead of waiting until fetching data from all slices. When data is sent, how the slices are distributed determines which messages are returned at each batch fetch operation.

That is one of the reasons why the Message Service does not ensure the consumed order of messages.