Search in sources :

Example 1 with MbusResponse

use of com.yahoo.messagebus.jdisc.MbusResponse in project vespa by vespa-engine.

the class ResponseMerger method handleResponse.

@Override
public ContentChannel handleResponse(Response response) {
    synchronized (this) {
        if (response instanceof MbusResponse) {
            Reply reply = ((MbusResponse) response).getReply();
            requestTrace.addChild(reply.getTrace().getRoot());
            replies.add(reply);
        }
        if (--numPending != 0) {
            return null;
        }
    }
    requestMsg.getTrace().getRoot().addChild(requestTrace);
    Reply reply = DocumentProtocol.merge(replies);
    Response mbusResponse = new MbusResponse(StatusCodes.fromMbusReply(reply), reply);
    ResponseDispatch.newInstance(mbusResponse).dispatch(responseHandler);
    return null;
}
Also used : Response(com.yahoo.jdisc.Response) MbusResponse(com.yahoo.messagebus.jdisc.MbusResponse) Reply(com.yahoo.messagebus.Reply) MbusResponse(com.yahoo.messagebus.jdisc.MbusResponse)

Example 2 with MbusResponse

use of com.yahoo.messagebus.jdisc.MbusResponse in project vespa by vespa-engine.

the class MbusRequestContext method processingFailed.

@Override
public void processingFailed(ErrorCode errorCode, String errorMsg) {
    MbusResponse response = new MbusResponse(errorCode.getDiscStatus(), requestMsg.createReply());
    response.getReply().addError(new com.yahoo.messagebus.Error(errorCode.getDocumentProtocolStatus(), errorMsg));
    ResponseDispatch.newInstance(response).dispatch(this);
}
Also used : MbusResponse(com.yahoo.messagebus.jdisc.MbusResponse)

Example 3 with MbusResponse

use of com.yahoo.messagebus.jdisc.MbusResponse in project vespa by vespa-engine.

the class MbusRequestContext method handleResponse.

@Override
public ContentChannel handleResponse(Response response) {
    if (responded.getAndSet(true)) {
        return null;
    }
    Reply reply = ((MbusResponse) response).getReply();
    reply.swapState(requestMsg);
    return responseHandler.handleResponse(response);
}
Also used : Reply(com.yahoo.messagebus.Reply) MbusResponse(com.yahoo.messagebus.jdisc.MbusResponse)

Aggregations

MbusResponse (com.yahoo.messagebus.jdisc.MbusResponse)3 Reply (com.yahoo.messagebus.Reply)2 Response (com.yahoo.jdisc.Response)1