Skip to content

[service-bus] Adjust receiveMessages() to match .NET's algorithm (with potential adjustments) #9718

@richardpark-msft

Description

@richardpark-msft

Currently the receiveMessages() call in JavaScript works differently than the .NET algorithm. As part of making our libraries more consistent we'd like to change that.

The existing behavior:

  1. User calls receiveMessages(numMessages, maxTime)
  2. Timer is set for maxTime
  3. as messages are received we continually debounce a timer for 1 second

We return if:

  • The debounced timer expires
  • numMessages has been reached
  • The maxTime has expired

In .NET the behavior is similar with slight differences that we would like to closely match:

  1. User calls receiveMessages(numMessages, maxTime)
  2. Timer is set for maxTime
  3. On receipt of first message set an absolute timer (no debounce) for 20 milliseconds

We return if:

  • The absolute timer expires
  • numMessages has been reached
  • The maxTime has expired

The work shouldn't be too bad since some of the same behaviors were already present. To do this work we will need:

  • Algorithm adjustment for batch receiver
    • Non-sessions
    • Sessions
  • Coordinated doc string update to describe the behavior, at least in regards to how maxWaitTime works.
  • Adjustment of the above timeout (possible). .NET's 20 milliseconds works well but they also have some other mitigating factors (background fetch into a buffer, etc..). It might still work for JS but we might want to stick with 1 second.

CC: @JoshLove-msft (to make sure my .NET description is accurate)

Metadata

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.Service Busblocking-releaseBlocks release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions