Skip to content

Commit

Permalink
ability to use a sync bus
Browse files Browse the repository at this point in the history
  • Loading branch information
philipparndt committed Jan 31, 2021
1 parent a7f9c72 commit 0c8c520
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class Events {
private final static Events events = new Events();
private final Executor executor = Executors.newFixedThreadPool(4);
private AsyncEventBus eventBus = new AsyncEventBus("mqtt", this.executor);
private EventBus eventBus = new AsyncEventBus("mqtt", this.executor);

private Events() {

Expand All @@ -27,6 +27,15 @@ public void resetBus() {
this.eventBus = new AsyncEventBus("mqtt", this.executor);
}

/**
* Call this method for test purpose only.
* This will create synchronous message bus. Use this to verify message
* order or that a message is not send.
*/
public void syncBus() {
this.eventBus = new EventBus();
}

public static void register(final Object object) {
events.eventBus.register(object);
}
Expand Down

0 comments on commit 0c8c520

Please sign in to comment.