Package com.couchbase.client.core.cnc
Class DefaultEventBus
java.lang.Object
com.couchbase.client.core.cnc.DefaultEventBus
- All Implemented Interfaces:
EventBus
The
DefaultEventBus provides the default and very efficient implementation
of the EventBus.
It is built on top of a very fast, bounded MPSC (multi-producer single-consumer) queue which allows to quickly send events into the bus without blocking the sender.
Subscribers of this API are considered to be non-blocking and if they have to blocking tasks need to fan them out into their own thread pool.
Keep in mind to properly start() and stop(Duration) since it runs in its
own thread!
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAllows to modify the default configuration of theDefaultEventBus.Nested classes/interfaces inherited from interface com.couchbase.client.core.cnc.EventBus
EventBus.PublishResult -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultEventBus.Builderbuilder(reactor.core.scheduler.Scheduler scheduler) static DefaultEventBuscreate(reactor.core.scheduler.Scheduler scheduler) Try to publish an event.reactor.core.publisher.Mono<Void> start()Starts theDefaultEventBus.reactor.core.publisher.Mono<Void> Stops theDefaultEventBusfrom running.voidunsubscribe(EventSubscription subscription)
-
Method Details
-
builder
-
create
-
subscribe
Description copied from interface:EventBus- Specified by:
subscribein interfaceEventBus- Parameters:
consumer- the consumer which will receive events.- Returns:
- a
EventSubscriptionthat can be used to unsubscribe.
-
unsubscribe
Description copied from interface:EventBus- Specified by:
unsubscribein interfaceEventBus- Parameters:
subscription- the subscription used.
-
publish
Description copied from interface:EventBusTry to publish an event.- Specified by:
publishin interfaceEventBus- Parameters:
event- the event to publish.- Returns:
- the
EventBus.PublishResultof th event.
-
start
Starts theDefaultEventBus. -
stop
Stops theDefaultEventBusfrom running.
-