GithubHelp home page GithubHelp logo

Comments (5)

jtaubensee avatar jtaubensee commented on June 12, 2024

@sharadholani - This is a new feature, that would need to be implemented by the service. With that said, what is the use case here?

I ask because even with a "shorter" lock duration of 30 seconds, our MessageHandler will automatically renew the lock for you. And generally speaking it is a bad practice to set a lock for a long duration. This is because a crashed process early on would keep that message from being re-delivered. i.e. its locked until the long lock expires.

from azure-service-bus-java.

sharadholani avatar sharadholani commented on June 12, 2024

We are not using QueueClient APIs. We are creating MessageReceiver objects directly and calling receive() , whenever we need to fetch messages.

I need to specify the message visibility timeout period when we make to call to get messages from service bus.
If this timeout period is less than the time required to process it, I would increase the lock duration by a specified amount by making an explicit call.

This feature is there in SQS and Azure Storage queue.
Our clients who would be moving from SQS to Service Bus would need a similar feature. Hence we would be needing APIs to control the visibility timeout period for a message.

from azure-service-bus-java.

jtaubensee avatar jtaubensee commented on June 12, 2024

@sharadholani - We generally recommend using the Queue/Topic/Subscription client API's as it can help solve some of these issues for you, and the Message Sender/Receiver is more for advanced scenarios that aren't met by the simplicity of the clients.

While the new feature that you have recommended is something that we can consider, its not currently on our road map, and therefore there is no time frame associated with it. If you'd like to officially request it, please do so in our 'parent' repo: https://github.com/azure/azure-service-bus

In the meantime, you probably have two choices:

  1. Use the MessageHandler that is available in the Queue/Subscription clients, which will renew the lock for you as needed.
  2. Continue using the MessageReceiver and manually renew the lock when the message.getExpiresAtUtc() is within 10 seconds of expiring. In order to do this, you will need to start a new thread.

from azure-service-bus-java.

sharadholani avatar sharadholani commented on June 12, 2024

QueueClient registers an IMessageHandler object which has onMessageAsync function. This function is invoked whenever there is a message in the queue.

In our case , we need to receive messages on Demand. The client can ask at any instant to get messages from queue. Only then are we supposed to query the queue for messages.

That is why we are using MessageReceiver objects directly instead of QueueClient .
Hence the issue with message locks.

Will the QueueClient have this on demand receive messages from the queue feature anytime soon ?

from azure-service-bus-java.

jtaubensee avatar jtaubensee commented on June 12, 2024

@sharadholani - I'm going to close this issue for now, as this isn't something that we are able to focus on during preview. As we've discussed outside of this thread, I think the best thing to do would be to create an extension method that will handle renewing the lock for you on the receiver.

from azure-service-bus-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.