Search in sources :

Example 1 with UpdateDocumentReply

use of com.yahoo.documentapi.messagebus.protocol.UpdateDocumentReply in project vespa by vespa-engine.

the class MessageBusSyncSession method update.

@Override
public boolean update(DocumentUpdate update, DocumentProtocol.Priority pri) {
    UpdateDocumentMessage msg = new UpdateDocumentMessage(update);
    msg.setPriority(pri);
    Reply reply = syncSend(msg);
    if (reply.hasErrors()) {
        throw new DocumentAccessException(MessageBusAsyncSession.getErrorMessage(reply), reply.getErrorCodes());
    }
    if (reply.getType() != DocumentProtocol.REPLY_UPDATEDOCUMENT) {
        throw new DocumentAccessException("Received unknown response: " + reply);
    }
    return ((UpdateDocumentReply) reply).wasFound();
}
Also used : UpdateDocumentReply(com.yahoo.documentapi.messagebus.protocol.UpdateDocumentReply) Reply(com.yahoo.messagebus.Reply) RemoveDocumentReply(com.yahoo.documentapi.messagebus.protocol.RemoveDocumentReply) UpdateDocumentReply(com.yahoo.documentapi.messagebus.protocol.UpdateDocumentReply) GetDocumentReply(com.yahoo.documentapi.messagebus.protocol.GetDocumentReply) UpdateDocumentMessage(com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage) DocumentAccessException(com.yahoo.documentapi.DocumentAccessException)

Aggregations

DocumentAccessException (com.yahoo.documentapi.DocumentAccessException)1 GetDocumentReply (com.yahoo.documentapi.messagebus.protocol.GetDocumentReply)1 RemoveDocumentReply (com.yahoo.documentapi.messagebus.protocol.RemoveDocumentReply)1 UpdateDocumentMessage (com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage)1 UpdateDocumentReply (com.yahoo.documentapi.messagebus.protocol.UpdateDocumentReply)1 Reply (com.yahoo.messagebus.Reply)1