Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

receiveMessages method with maxWaitTime not working as expected #414

Open
abhijitkushwaha1998 opened this issue May 26, 2021 · 0 comments
Open

Comments

@abhijitkushwaha1998
Copy link

Actual Behavior

  1. 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.
  2. 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

  1. it should wait for maximum number of messages to receive before it times out.

Versions

  • OS platform and version: NA
  • Maven package version or commit ID: 7.0.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant