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

Introduce RxJava-based Event Bus #330

Merged
merged 20 commits into from
Jan 27, 2025
Merged

Introduce RxJava-based Event Bus #330

merged 20 commits into from
Jan 27, 2025

Conversation

taldekar
Copy link
Contributor

@taldekar taldekar commented Jan 24, 2025

Issue #322

Description of changes:
This PR introduces an Event Bus implementation using RxJava. The Event Bus is hosted in the EventBroker class, which provides methods to post and subscribe to events of arbitrary type. Two new interfaces were introduced as part of the Brokers API, since the original implementations weren't explicitly designed for an Event Bus use-case and didn't make their function clear to the programmer. The first is an EventObserver which is the primary method of subscribing to events by overriding the onEvent(event) method. The other interface is Subscription which is returned when Subscribing to an new event stream and provides a method cancel() to cancel the subscription. The subscriber callbacks are all handled by a separate scheduler, so the publishing thread isn't blocked.

The EventBroker has also been integrated into the code base and replaces the AuthStatusChangedListener.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@taldekar taldekar requested a review from breedloj January 24, 2025 18:17
@breedloj
Copy link
Contributor

Looks good! Do you plan to add tests for the event broker?

@taldekar
Copy link
Contributor Author

Looks good! Do you plan to add tests for the event broker?

Yup, I'll add them now!

@taldekar taldekar closed this Jan 27, 2025
@taldekar taldekar reopened this Jan 27, 2025
@taldekar taldekar merged commit 283be03 into main Jan 27, 2025
1 check passed
@taldekar taldekar deleted the taldekar/EventBus branch January 27, 2025 21:33
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.

3 participants