Created
March 30, 2020 15:04
-
-
Save jdob/2755558e26eae145e3aaaaf0bc78d25e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void start(Future<Void> done) { | |
Single<DataGridClient> single = DataGridClient.create(vertx, new DataGridConfiguration() | |
.setHost("eventstore-dg-hotrod") | |
.setPort(11333)); | |
single.flatMap(client -> client.<String, String>getCache("users")) | |
.flatMap(cache -> cache.clear().andThen(Single.just(cache))) | |
.subscribe( | |
cache -> { | |
this.cache = cache; | |
LOGGER.info("User Simulator initialized"); | |
configure(config()); | |
vertx.eventBus().<JsonObject>consumer("configuration", m -> configure(m.body().getJsonObject("user-simulator"))); | |
vertx.eventBus().<Boolean>consumer("user-simulator-toggle", b -> toggle(b.body())); | |
done.complete(null); | |
}, | |
err -> { | |
LOGGER.error("Unable to initialize the User Simulator"); | |
done.fail(err); | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment