when to create different hubs vs group in azure web pub sub

321 Views Asked by At

I am bit confused about the right approach or what are the deciding factors to consider when creating separate hubs vs separate groups within a hub.

In my app there are 2 cases where we are using pub sub:

  1. Multiple user have access to same data. In order to avoid overriding changes done by one user by another we use locking mechanism so that only 1 user can edit the data at any given point. Pub sub notifies users if data they are viewing is locked.
  2. We have some long running report generation process and we use pub sub to get state update of the long running process

We currently have single hub created("MY-APP-HUB") for the entire application, and for both of these use cases have separate groups created "LOCK-DATA-[IDENTIFIER OF THE DATA]-GROUP" and "REPORT-[IDENTIFIER OF THE REPORT]-GROUP". Works well no issues there.

However I am wondering if I should create separate HUB for each action so "LOCK-DATA-HUB" and "REPORT-HUB", and then have separate groups created for each data unit. So for eg within "LOCK-DATA-HUB", create a group "DATA-1-GRP", "DATA-2-GRP", similarly "REPORT-1-GRP", "REPORT-2-GRP" for "REPORT-HUB".

I am honestly not sure if I am doing things correctly. At one hand having all messages associated with an app going through a hub makes sense to me and managing just single token is simpler.

But creating hub per action/feature is not bad either. My only concern here would be if multiple application sharing same pub sub have similar actions going on but that could be avoided by adding some application identifier to the hub name I suppose.

0

There are 0 best solutions below