Update ResponseError.java and AsyncTdMiddleEventBusClient.java
This commit is contained in:
parent
f3eed20bf7
commit
cdfc68d30f
@ -123,4 +123,9 @@ public class ResponseError extends IOException {
|
|||||||
.replace(" ", "")
|
.replace(" ", "")
|
||||||
.replace(" = ", "=");
|
.replace(" = ", "=");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,20 +305,19 @@ public class AsyncTdMiddleEventBusClient extends AbstractVerticle implements Asy
|
|||||||
|
|
||||||
return Mono.from(tdClosed).single()
|
return Mono.from(tdClosed).single()
|
||||||
.filter(tdClosed -> !tdClosed)
|
.filter(tdClosed -> !tdClosed)
|
||||||
.flatMap(_x -> Mono.<TdResult<T>>create(sink -> {
|
.<TdResult<T>>handle((_x, sink) -> {
|
||||||
cluster.getEventBus().request(botAddress + ".execute", req, cluster.newDeliveryOpts().setLocalOnly(local), (AsyncResult<Message<TdResultMessage>> event) -> {
|
cluster.getEventBus().request(botAddress + ".execute", req, cluster.newDeliveryOpts().setLocalOnly(local), (AsyncResult<Message<TdResultMessage>> event) -> {
|
||||||
if (event.succeeded()) {
|
if (event.succeeded()) {
|
||||||
if (event.result().body() == null) {
|
if (event.result().body() == null) {
|
||||||
sink.success();
|
sink.complete();
|
||||||
} else {
|
} else {
|
||||||
sink.success(Objects.requireNonNull(event.result().body()).toTdResult());
|
sink.next(Objects.requireNonNull(event.result().body()).toTdResult());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sink.error(ResponseError.newResponseError(request, botAlias, event.cause()));
|
sink.error(ResponseError.newResponseError(request, botAlias, event.cause()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}).handle((response, sink) -> {
|
||||||
})).flatMap(response -> {
|
|
||||||
try {
|
try {
|
||||||
Objects.requireNonNull(response);
|
Objects.requireNonNull(response);
|
||||||
if (OUTPUT_REQUESTS) {
|
if (OUTPUT_REQUESTS) {
|
||||||
@ -328,9 +327,9 @@ public class AsyncTdMiddleEventBusClient extends AbstractVerticle implements Asy
|
|||||||
.replace(" ", "")
|
.replace(" ", "")
|
||||||
.replace(" = ", "="));
|
.replace(" = ", "="));
|
||||||
}
|
}
|
||||||
return Mono.just((TdResult<T>) response);
|
sink.next(response);
|
||||||
} catch (ClassCastException | NullPointerException e) {
|
} catch (ClassCastException | NullPointerException e) {
|
||||||
return Mono.error(e);
|
sink.error(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user