@Stability.Internal public class SimpleEventBus extends Object implements EventBus
EventBus.PublishResult
Constructor and Description |
---|
SimpleEventBus(boolean ignoreSystemEvents)
Creates a new
SimpleEventBus . |
SimpleEventBus(boolean ignoreSystemEvents,
List<Class<? extends Event>> othersToIgnore)
Creates a new
SimpleEventBus . |
Modifier and Type | Method and Description |
---|---|
EventBus.PublishResult |
publish(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.
|
EventSubscription |
subscribe(Consumer<Event> consumer)
|
void |
unsubscribe(EventSubscription subscription)
|
public SimpleEventBus(boolean ignoreSystemEvents)
SimpleEventBus
.
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.
ignoreSystemEvents
- true if they should be ignored (recommended), false otherwise.public SimpleEventBus(boolean ignoreSystemEvents, List<Class<? extends Event>> othersToIgnore)
SimpleEventBus
.
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.
ignoreSystemEvents
- true if they should be ignored (recommended), false otherwise.othersToIgnore
- other list of events to ignore.public EventBus.PublishResult publish(Event event)
EventBus
publish
in interface EventBus
event
- the event to publish.EventBus.PublishResult
of th event.public EventSubscription subscribe(Consumer<Event> consumer)
EventBus
subscribe
in interface EventBus
consumer
- the consumer which will receive events.EventSubscription
that can be used to unsubscribe.public void unsubscribe(EventSubscription subscription)
EventBus
unsubscribe
in interface EventBus
subscription
- the subscription used.public Mono<Void> start()
EventBus
Copyright © 2020 Couchbase, Inc.. All rights reserved.