Package com.couchbase.client.core.cnc
Class SimpleEventBus
- java.lang.Object
-
- com.couchbase.client.core.cnc.SimpleEventBus
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.couchbase.client.core.cnc.EventBus
EventBus.PublishResult
-
-
Constructor Summary
Constructors Constructor Description SimpleEventBus(boolean ignoreSystemEvents)Creates a newSimpleEventBus.SimpleEventBus(boolean ignoreSystemEvents, List<Class<? extends Event>> othersToIgnore)Creates a newSimpleEventBus.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()EventBus.PublishResultpublish(Event event)Try to publish an event.List<Event>publishedEvents()Mono<Void>start()Starts the event bus if it hasn't been started yet.Mono<Void>stop(Duration timeout)Stops the event bus if it hasn't been stopped already.EventSubscriptionsubscribe(Consumer<Event> consumer)voidunsubscribe(EventSubscription subscription)
-
-
-
Constructor Detail
-
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
public SimpleEventBus(boolean ignoreSystemEvents, List<Class<? extends Event>> othersToIgnore)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 Detail
-
publish
public EventBus.PublishResult publish(Event event)
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
public EventSubscription subscribe(Consumer<Event> consumer)
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
public void unsubscribe(EventSubscription subscription)
Description copied from interface:EventBus- Specified by:
unsubscribein interfaceEventBus- Parameters:
subscription- the subscription used.
-
clear
public void clear()
-
start
public Mono<Void> start()
Description copied from interface:EventBusStarts the event bus if it hasn't been started yet.
-
-