I am working on azure service bus and using ServiceBusReceiverClient.receiveMessages(int maxMessages, Duration maxWaitTime) method to receive the message from the service bus, my use case is to receive batch of messages in specific amount of time. But this is not working as expected it is not waiting for duration maxWaitTime.
it start the processing of the message as soon as one message is received.
below is code snippet :
`ServiceBusReceiverClient receiver = new ServiceBusClientBuilder()
.connectionString(connectionString)
.receiver()
.maxAutoLockRenewDuration(Duration.ofMinutes(1))
.queueName("<>")
.buildClient();
while (true) {
Iterator<ServiceBusReceivedMessage> iterator = receiver.receiveMessages(10, Duration.ofMinutes(2)).iterator();
while (iterator.hasNext()) {
ServiceBusReceivedMessage serviceBusReceivedMessage = (ServiceBusReceivedMessage) iterator.next();
System.out.println("received message is ->"+serviceBusReceivedMessage.getBody());
}
}`
Expected Behavior
it should wait for maximum number of messages to receive before it times out.
Actual Behavior
below is code snippet :
`ServiceBusReceiverClient receiver = new ServiceBusClientBuilder() .connectionString(connectionString) .receiver() .maxAutoLockRenewDuration(Duration.ofMinutes(1)) .queueName("<>")
.buildClient();
while (true) {
Expected Behavior
Versions