ari-proxy icon indicating copy to clipboard operation
ari-proxy copied to clipboard

Improve bus for large numbers of similar subscriptions

Open Ulexus opened this issue 4 years ago • 0 comments

Previously, we created a new NATS subscription for each ARI subscription, which is inefficient for large numbers of similar subscriptions. (See Issue #26)

With this change, we now retain a single NATS subscription for any number of ari subscriptions for which the same NATS subscription is sufficient, regardless of where in the tree of ARI clients it may be.

To do this, we create a root-level (core) back-to-back event bus, with the NATS subscription being bound to a stdbus ARI bus. All ari-proxy clients subtend a new SubBus, which forwards all requests on to the core ARI bus, registering them along the way. When the SubBus is closed, the bound subscriptions will be closed, but the root-level bus itself will stay in existence.

There is a remaining issue wherein long-running root-level ari-proxy clients will accumulate NATS subscriptions and not have them terminate even after all SubBuses are closed. This will need to be fixed in a later patch, but it should not affect most uses, for now.

Fixes #26


This change is Reviewable

Ulexus avatar Mar 18 '20 19:03 Ulexus