Skip to content

Instantly share code, notes, and snippets.

@chermehdi
Created November 4, 2018 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chermehdi/33c05183a276e21dcbea8e4ea1d430a7 to your computer and use it in GitHub Desktop.
Save chermehdi/33c05183a276e21dcbea8e4ea1d430a7 to your computer and use it in GitHub Desktop.
EventBusContract
package io.github.chermehdi.bus;
import java.util.List;
/**
* Description of the contract of a generic EventBus implementation, the library contains two main
* version, Sync and Async event bus implementations, if you want to provide your own implementation
* and stay compliant with the components of the library just implement this contract
*
* @author chermehdi
*/
public interface EventBus {
/**
* registers a new subscribable to this EventBus instance
*/
void register(Subscribable subscribable);
/**
* send the given event in this EventBus implementation to be consumed by interested subscribers
*/
void dispatch(Event<?> event);
/**
* get the list of all the subscribers associated with this EventBus instance
*/
List<Subscribable> getSubscribers();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment