Package com.couchbase.client.core.event
Interface EventBus
-
- All Known Implementing Classes:
DefaultEventBus
public interface EventBus
Defines the interface for a generic event bus.- Since:
- 1.1.0
- Author:
- Michael Nitschinger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description rx.Observable<CouchbaseEvent>
get()
Subscribe to the event bus to retrieveCouchbaseEvent
s.boolean
hasSubscribers()
Checks if the event bus has subscribers.void
publish(CouchbaseEvent event)
Publish aCouchbaseEvent
into the bus.
-
-
-
Method Detail
-
get
rx.Observable<CouchbaseEvent> get()
Subscribe to the event bus to retrieveCouchbaseEvent
s.- Returns:
- the observable where the events are emitted into.
-
publish
void publish(CouchbaseEvent event)
Publish aCouchbaseEvent
into the bus.- Parameters:
event
- the event to publish.
-
hasSubscribers
boolean hasSubscribers()
Checks if the event bus has subscribers. This method can be utilized on the publisher side to avoid complex event creation when there is no one on the other side listening and the event would be discarded immediately afterwards.- Returns:
- true if it has subscribers, false otherwise.
-
-