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

Add Alternate Implementation or Flag for MessageBus that Allows Weak References #247

Open
Chris3606 opened this issue Oct 3, 2021 · 1 comment
Milestone

Comments

@Chris3606
Copy link
Owner

Although it does not fit all use cases, it can be useful to have either a flag for the existing implementation, or a separate message bus implementation that uses weak references for subscribers could be useful. This would trade the bus being an owner for the subscribers being an owner of would allow subscribers to arbitrarily disappear and not have to be removed from the bus to be GCed.

It disallows:

// object would be GCed since no strong reference is being maintained
bus.RegisterSubscriber(new SubscriberObject());

However can be useful for select cases, provided:

  1. It is not a default
  2. The method of activating/deactivating the feature makes it clear what the ramifications are
@Chris3606
Copy link
Owner Author

I don't think it's feasible to include this in the current version; so this would be a new version of MessageBus, and won't be a breaking change.

@Chris3606 Chris3606 added this to the 3.x milestone Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant