Package com.couchbase.client.core.cnc
Class SimpleEventBus
java.lang.Object
com.couchbase.client.core.cnc.SimpleEventBus
- All Implemented Interfaces:
EventBus
This super simple event bus should be used in testing only to assert certain
events got pushed through.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.couchbase.client.core.cnc.EventBus
EventBus.PublishResult -
Constructor Summary
ConstructorsConstructorDescriptionSimpleEventBus(boolean ignoreSystemEvents) Creates a newSimpleEventBus.SimpleEventBus(boolean ignoreSystemEvents, List<Class<? extends Event>> othersToIgnore) Creates a newSimpleEventBus. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Try to publish an event.reactor.core.publisher.Mono<Void> start()Starts the event bus if it hasn't been started yet.reactor.core.publisher.Mono<Void> Stops the event bus if it hasn't been stopped already.voidunsubscribe(EventSubscription subscription)
-
Constructor Details
-
SimpleEventBus
public SimpleEventBus(boolean ignoreSystemEvents) Creates a newSimpleEventBus.Note that in general you want to ignore system events since they add nondeterminism during assertions when things like garbage collections happen. Of course if you need to test/verify system events, set the argument to false.
- Parameters:
ignoreSystemEvents- true if they should be ignored (recommended), false otherwise.
-
SimpleEventBus
Creates a newSimpleEventBus.Note that in general you want to ignore system events since they add nondeterminism during assertions when things like garbage collections happen. Of course if you need to test/verify system events, set the argument to false.
- Parameters:
ignoreSystemEvents- true if they should be ignored (recommended), false otherwise.othersToIgnore- other list of events to ignore.
-
-
Method Details
-
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.
-
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.
-
publishedEvents
-
clear
public void clear() -
start
Description copied from interface:EventBusStarts the event bus if it hasn't been started yet. -
stop
Description copied from interface:EventBusStops the event bus if it hasn't been stopped already.
-