Closed ganeshpft closed 4 years ago
The API receiveBatch() says that it will receive upto the batch size of messages, not exact batch size of messages. We don't have any API that fetches exactly batch size of messages.
The actual issue here is loss of messages. Active Message count reduced by given batch size instead of received message count.
RECEIVEANDDELETE mode might lose messages, but only in cases of network errors. It shouldn't lose almost 100 messages as in your case. Can you reproduce the same thing using regular AMQP transport? non websockets? Is the entity partitioned? How did you send messages websockets or something else? Are any messages larger than 4 KB? For partitioned entities, receiving messages larger than 4 KB wouldn't have worked. A fix is being rolled out to service this week.
Partitioning is false. Messages posted using TransportType.AMQP_WEB_SOCKETS and all posted messages are less than 4KB only. (4KB issue we already aware.)
Will execute the same test case with TransportType.AMQP then publish the results once again.
Same issue facing with the TransportType.AMQP also. PFA for Iteration results
Lib used - >azure-service-2.0.0.jar
POM
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-servicebus</artifactId>
<version>2.0.0</version>
</dependency>
Now I see what is causing your issue. After every receive batch call, you are closing the receiver. That's why those messages are lost. They are in the closed receiver. Here is what is happening..
Is there any way to read the messages from the closed receiver? or before closing the connection can we able to check any messages available in the receiver?
One receiver per receive call, with PEEKLOCK mode also wont solve the receiveBatch problem. (n - Batch Size, x - Received Message Count) In receiveBatch API call, x messages received and n-x messages will be in locked state because of connection closed. In this scenario, locked messages will be available after lock duration expired. And also there is a chance of moving to DLQ if max delivery count exceeds
No. You cannot read messages from a closed receiver. Agree with the second observation. Still one receiver for each receiveBatch() call is not a good idea.
Actual Behavior
Expected Behavior
Steps To Produce
API References
Versions
Attachments
ASB - ReceiveBatch log.txt ASB Code Snippet.txt