use of com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage in project vespa by vespa-engine.
the class DocumentProcessingHandlerAllMessageTypesTestCase method update.
private void update() throws InterruptedException {
DocumentUpdate documentUpdate = new DocumentUpdate(getType(), "doc:baz:foo");
UpdateDocumentMessage message = new UpdateDocumentMessage(documentUpdate);
assertTrue(sendMessage(FOOBAR, message));
Message result = remoteServer.awaitMessage(60, TimeUnit.SECONDS);
assertNotNull(result);
remoteServer.ackMessage(result);
Reply reply = driver.client().awaitReply(60, TimeUnit.SECONDS);
assertNotNull(reply);
assertThat(result, instanceOf(UpdateDocumentMessage.class));
UpdateDocumentMessage outputMsg = (UpdateDocumentMessage) result;
assertThat(outputMsg.getDocumentUpdate().getId().toString(), is("doc:baz:foo"));
assertFalse(reply.hasErrors());
}
use of com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage 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();
}
Aggregations