I need to implement a pub/sub system within a domain model. I was thinking about using Guava's EventBus, but I'd like to use interfaces and adapters to keep my domain model ignorant of such an implementation detail. Unfortunately, EventBus's use of annotations for subscription throw a monkey wrench at this idea.
Is there any way to subscribe a handler without using the @Subscribe annotation? Looking at the docs, there doesn't seem to be but perhaps there's something I'm not seeing.
Thanks!
Guava team member here.
It's quite deliberate that you can only subscribe a handler with the @Subscribe
annotation -- EventBus
is intended to replace interfaces, adapters, etc., not to supplement them -- but why do you say that exposes more implementation details? In our experience, it usually exposes fewer details.