How can we improve the Windows Azure Service Bus?

Provide gracefull shutdown feature to Message Pump in Queue and Subscription Clients

There is not a good way to deal with a graceful shutdown of a Worker role using the OnMessage approach of processing queue messages off the service bus. It would be nice if you could call StopProcessing, or something similar on the QueueClient or SubscriptionClient so that they would stop their internal receive loop, but finish processing the messages they may already be processing. A count property of active processing messages would also be helpful so that in an OnStop method on the worker role you could call the StopProcessing and enter a loop till the active processing messages was zero.

Perhaps actually creating a new class called a MessagePump which accepted a QueueClient or SubscriptionClient as part of the constructor would be a good route to provide a better break down of responsibilities.

57 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    MikeWoMikeWo shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    under review  ·  Abhishek LalAdminAbhishek Lal (Admin, Microsoft Azure) responded  · 

    This is a great suggestion Mike. This does not only apply to OnMessage APIs, it will be applicable for making pending Receive(timeout) calls too in the case of a graceful shutdown when several of these are pending. Any specific requirements or suggestions on what API shape/pattern you would like to see are appreciated.

    2 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Aaron StainbackAaron Stainback commented  ·   ·  Flag as inappropriate

        It looks like even now when I close the queueclient underneath the message pump still receives messages for a bit.

      • ThomasThomas commented  ·   ·  Flag as inappropriate

        It would also be good if locked prefetch'ed messages were abandoned automatically when doing this graceful shutdown.

      Feedback and Knowledge Base