use of io.vertx.core.eventbus.ReplyFailure in project chili-core by codingchili.
the class BusRouter method send.
protected void send(Request request, String target) {
DeliveryOptions options = new DeliveryOptions().setSendTimeout(request.timeout());
core.bus().send(target, request.data(), options, send -> {
if (send.succeeded()) {
request.write(send.result().body());
} else {
Throwable exception = send.cause();
if (exception instanceof ReplyException) {
ReplyFailure status = ((ReplyException) exception).failureType();
exceptionHandlers.get(status).accept(request);
} else {
request.error(send.cause());
}
}
});
}
use of io.vertx.core.eventbus.ReplyFailure in project vert.x by eclipse.
the class ReplyExceptionMessageCodec method decodeFromWire.
@Override
public ReplyException decodeFromWire(int pos, Buffer buffer) {
int i = (int) buffer.getByte(pos);
ReplyFailure rf = ReplyFailure.fromInt(i);
pos++;
int failureCode = buffer.getInt(pos);
pos += 4;
boolean isNull = buffer.getByte(pos) == (byte) 0;
String message;
if (!isNull) {
pos++;
int strLength = buffer.getInt(pos);
pos += 4;
byte[] bytes = buffer.getBytes(pos, pos + strLength);
message = new String(bytes, CharsetUtil.UTF_8);
} else {
message = null;
}
return new ReplyException(rf, failureCode, message);
}
Aggregations