Search in sources :

Example 1 with BatchDocumentUpdateMessage

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

the class DocumentProcessingHandlerAllMessageTypesTestCase method batchDocumentUpdate.

private void batchDocumentUpdate() throws InterruptedException {
    DocumentUpdate doc1 = new DocumentUpdate(getType(), new DocumentId("userdoc:test:12345:multi:1"));
    DocumentUpdate doc2 = new DocumentUpdate(getType(), new DocumentId("userdoc:test:12345:multi:2"));
    Field testField = getType().getField("blahblah");
    doc1.addFieldUpdate(FieldUpdate.createAssign(testField, new StringFieldValue("1 not yet processed")));
    doc2.addFieldUpdate(FieldUpdate.createAssign(testField, new StringFieldValue("2 not yet processed")));
    BatchDocumentUpdateMessage message = new BatchDocumentUpdateMessage(12345);
    message.addUpdate(doc1);
    message.addUpdate(doc2);
    assertTrue(sendMessage(FOOBAR, message));
    Message remote1 = remoteServer.awaitMessage(60, TimeUnit.SECONDS);
    assertTrue(remote1 instanceof UpdateDocumentMessage);
    remoteServer.ackMessage(remote1);
    assertNull(driver.client().awaitReply(100, TimeUnit.MILLISECONDS));
    Message remote2 = remoteServer.awaitMessage(60, TimeUnit.SECONDS);
    assertTrue(remote2 instanceof UpdateDocumentMessage);
    remoteServer.ackMessage(remote2);
    Reply reply = driver.client().awaitReply(60, TimeUnit.SECONDS);
    assertNotNull(reply);
    assertFalse(reply.hasErrors());
}
Also used : PutDocumentMessage(com.yahoo.documentapi.messagebus.protocol.PutDocumentMessage) UpdateDocumentMessage(com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage) Message(com.yahoo.messagebus.Message) GetDocumentMessage(com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage) RemoveDocumentMessage(com.yahoo.documentapi.messagebus.protocol.RemoveDocumentMessage) BatchDocumentUpdateMessage(com.yahoo.documentapi.messagebus.protocol.BatchDocumentUpdateMessage) StringFieldValue(com.yahoo.document.datatypes.StringFieldValue) BatchDocumentUpdateMessage(com.yahoo.documentapi.messagebus.protocol.BatchDocumentUpdateMessage) Reply(com.yahoo.messagebus.Reply) UpdateDocumentMessage(com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage)

Aggregations

StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)1 BatchDocumentUpdateMessage (com.yahoo.documentapi.messagebus.protocol.BatchDocumentUpdateMessage)1 GetDocumentMessage (com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage)1 PutDocumentMessage (com.yahoo.documentapi.messagebus.protocol.PutDocumentMessage)1 RemoveDocumentMessage (com.yahoo.documentapi.messagebus.protocol.RemoveDocumentMessage)1 UpdateDocumentMessage (com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage)1 Message (com.yahoo.messagebus.Message)1 Reply (com.yahoo.messagebus.Reply)1