Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options to use multiple brokers and presence managers #394

Merged
merged 11 commits into from
Jul 3, 2024

Conversation

FZambia
Copy link
Member

@FZambia FZambia commented Jul 2, 2024

A couple of options for Node's Config:

// GetBroker when set allows returning a custom Broker to use for a specific channel. If not set
// then the default Node's Broker is always used for all channels. Also, Node's default Broker is
// always used for control channels. It's the responsibility of an application to call Broker.Run
// method of all brokers except the default one (called automatically inside Node.Run). Also, a
// proper Broker shutdown is the responsibility of application because Node does not know about
// custom Broker instances. When GetBroker returns false as the second argument then Node will
// use the default Broker for the channel.
GetBroker func(channel string) (Broker, bool)
// GetPresenceManager when set allows returning a custom PresenceManager to use for a specific
// channel. If not set then the default Node's PresenceManager is always used for all channels.
// A proper PresenceManager shutdown is the responsibility of application because Node does not
// know about custom PresenceManager instances. When GetPresenceManager returns false as the second
// argument then Node will use the default PresenceManager for the channel.
GetPresenceManager func(channel string) (PresenceManager, bool)

This opens a way to interesting combinations – to inherit various channel options within one setup, opens new ways to scale.

Also, adding a possibility to have Publication.Channel which differs from subscription channel. This opens a road to utilize Broker's wildcard subscriptions. Wildcard subscriptions come with various limitations regarding Centrifuge features - such as join/leave events, presence, history, recovery - those won't work. But at the same time sometimes having a wildcard subscription with at most once delivery is necessary to keep the number of client channels small and thus achive very efficient consuming. I see how this may be especially useful with the addition of GetBroker option – because now it's possible to only use wildcards for a specific subset of channels. And still have all Centrifuge features for other channels.

Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 95.08197% with 3 lines in your changes missing coverage. Please review.

Project coverage is 81.74%. Comparing base (df55c9c) to head (87e0e91).

Files Patch % Lines
node.go 93.87% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #394      +/-   ##
==========================================
+ Coverage   81.60%   81.74%   +0.13%     
==========================================
  Files          40       40              
  Lines        7107     7127      +20     
==========================================
+ Hits         5800     5826      +26     
+ Misses        934      929       -5     
+ Partials      373      372       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@FZambia FZambia marked this pull request as ready for review July 2, 2024 20:02
@FZambia FZambia merged commit 1357b2b into master Jul 3, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant