Skip to content
This repository has been archived by the owner on Apr 30, 2019. It is now read-only.

Count handlers #103

Closed
melug opened this issue Feb 6, 2014 · 2 comments
Closed

Count handlers #103

melug opened this issue Feb 6, 2014 · 2 comments

Comments

@melug
Copy link

melug commented Feb 6, 2014

I am looking for a way to count number of subscribers for a specific event. The methods of Bus class have private fields and methods that its child class can't access. Because, my interest is "if anyone have received event?", currently I can't answer question, or is there a way to work around?

@amangel
Copy link

amangel commented Feb 6, 2014

If an event is posted, and there are no subscribers to receive it, a DeadEvent will be posted that contains the event itself, and the object that created it.
See: https://github.com/square/otto/blob/master/library/src/main/java/com/squareup/otto/DeadEvent.java

@JakeWharton
Copy link
Collaborator

Yes, DeadEvent is the proper way to do this. If you need to know about the number of subscribers or who the subscribers are then an event bus is likely not the right pattern.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants