This commit is contained in:
Andrea Cavalli 2021-09-09 20:14:00 +02:00
parent 84bf1eee85
commit eb6d6cf22b

View File

@ -105,12 +105,30 @@ public class AsyncTdMiddleEventBusServer extends AbstractVerticle {
if (this.td.tryEmitValue(td).isFailure()) { if (this.td.tryEmitValue(td).isFailure()) {
throw new IllegalStateException("Failed to set td instance"); throw new IllegalStateException("Failed to set td instance");
} }
return onSuccessfulStartRequest(td, botAddress, botAlias, botId, local); return new OnSuccessfulStartRequestInfo(td, botAddress, botAlias, botId, local);
}) })
.flatMap(r -> onSuccessfulStartRequest(r.td, r.botAddress, r.botAlias, r.botId, r.local))
.doOnSuccess(s -> logger.trace("Stated verticle")) .doOnSuccess(s -> logger.trace("Stated verticle"))
); );
} }
private static class OnSuccessfulStartRequestInfo {
public final AsyncTdDirectImpl td;
public final String botAddress;
public final String botAlias;
public final int botId;
public final boolean local;
public OnSuccessfulStartRequestInfo(AsyncTdDirectImpl td, String botAddress, String botAlias, int botId, boolean local) {
this.td = td;
this.botAddress = botAddress;
this.botAlias = botAlias;
this.botId = botId;
this.local = local;
}
}
private Mono<Void> onSuccessfulStartRequest(AsyncTdDirectImpl td, String botAddress, String botAlias, int botId, boolean local) { private Mono<Void> onSuccessfulStartRequest(AsyncTdDirectImpl td, String botAddress, String botAlias, int botId, boolean local) {
return td return td
.initialize() .initialize()