Skip to content

Session enabled service bus acceptNextSession timeout #31234

Open

Description

  • Package Name: @azure/service-bus
  • Package Version: 7.9.4
  • Operating system: linux
  • nodejs
    • version: 20
  • browser
    • name/version: NA
  • typescript
    • version:5.1.5
  • Is the bug related to documentation in

Describe the bug
We have a scenario where a publisher publishes a user's activity to other microservices(consumer), which process the data based on the received event. There is a strict requirement for in-order processing of events at the consumer side. We have been using service bus without sessions for some use cases, and want to use a service bus for this scenario as well. We have done a PoC, but we couldn’t come up with a good implementation for the sessions. Here’s what we have done

  • Created a session enabled service bus.
  • We are using userId as the sessionId at the publisher side
  • Due to the large number of users, consumers won’t know the session IDs. So, we use acceptNextSession to retrieve the next available session and create a session-enabled receiver.
  • Subscribe to the receiver and process messages as they arrive.

If there are no sessions available at the time of deployment then acceptNextSession timeout because it can not find a non empty session. So one consumer instance can consume only one user's event and then wait for the next message from the same user, which means only 10-15 user's event can be processed until or unless consumer restarts(or we do it in loop with handling many scenarios) and gets a session corresponding to a different user .

This seems to be a common use case. We searched extensively online but couldn’t find any good solution besides using a sessionRoundRobin. We have seen similar(#10330 created a long time back) and related issues in this repository but none of them gives an elegant solution.

Could you help us with a better solution for this scenario (Not very comfortable with round robin code)? or is this not the right use case for service bus?

To Reproduce
Steps to reproduce the behavior:

  1. acceptNextSession

Expected behavior
A consumer is assigned a session and processes all the messages from that session. Once all messages are consumed, a new session is assigned to the consumer, and the process repeats.

Screenshots
N/A

Additional context
N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Service AttentionWorkflow: This issue is responsible by Azure service team.Service Buscustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions