Search in sources :

Example 11 with GetDocumentMessage

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

the class GetSearcher method sendDocumentGetMessages.

private void sendDocumentGetMessages(List<String> documentIds, String fieldSet, SingleSender sender) {
    for (String docIdStr : documentIds) {
        DocumentId docId = new DocumentId(docIdStr);
        GetDocumentMessage getMsg = new GetDocumentMessage(docId, fieldSet);
        sender.send(getMsg);
        if (log.isLoggable(LogLevel.DEBUG)) {
            log.log(LogLevel.DEBUG, "Sent GetDocumentMessage for " + docId.toString());
        }
    }
}
Also used : DocumentId(com.yahoo.document.DocumentId) GetDocumentMessage(com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage)

Example 12 with GetDocumentMessage

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

the class MessageBusSyncSession method get.

@Override
public Document get(DocumentId id, String fieldSet, DocumentProtocol.Priority pri, Duration timeout) {
    GetDocumentMessage msg = new GetDocumentMessage(id, fieldSet);
    msg.setPriority(pri);
    Reply reply = syncSend(msg, timeout != null ? timeout : defaultTimeout);
    if (reply.hasErrors()) {
        throw new DocumentAccessException(MessageBusAsyncSession.getErrorMessage(reply));
    }
    if (reply.getType() != DocumentProtocol.REPLY_GETDOCUMENT) {
        throw new DocumentAccessException("Received unknown response: " + reply);
    }
    GetDocumentReply docReply = ((GetDocumentReply) reply);
    Document doc = docReply.getDocument();
    if (doc != null) {
        doc.setLastModified(docReply.getLastModified());
    }
    return doc;
}
Also used : GetDocumentMessage(com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage) 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) Document(com.yahoo.document.Document) GetDocumentReply(com.yahoo.documentapi.messagebus.protocol.GetDocumentReply) DocumentAccessException(com.yahoo.documentapi.DocumentAccessException)

Example 13 with GetDocumentMessage

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

the class VisitorDataQueueTest method unknown_message_throws_unsupported_operation_exception.

@Test(expected = UnsupportedOperationException.class)
public void unknown_message_throws_unsupported_operation_exception() {
    final VisitorDataQueue queue = new VisitorDataQueue();
    queue.onMessage(new GetDocumentMessage(new DocumentId("id:foo:testdoc::bar")), createDummyAckToken());
}
Also used : GetDocumentMessage(com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage) DocumentId(com.yahoo.document.DocumentId) Test(org.junit.Test)

Aggregations

GetDocumentMessage (com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage)13 Test (org.junit.Test)9 Message (com.yahoo.messagebus.Message)8 ClusterList (com.yahoo.vespaclient.ClusterList)8 Chain (com.yahoo.component.chain.Chain)7 FeedContext (com.yahoo.feedapi.FeedContext)7 MessagePropertyProcessor (com.yahoo.feedapi.MessagePropertyProcessor)7 NullFeedMetric (com.yahoo.feedhandler.NullFeedMetric)7 Searcher (com.yahoo.search.Searcher)7 Execution (com.yahoo.search.searchchain.Execution)7 Result (com.yahoo.search.Result)6 DocumentId (com.yahoo.document.DocumentId)3 Reply (com.yahoo.messagebus.Reply)2 FeederConfig (com.yahoo.vespaclient.config.FeederConfig)2 Document (com.yahoo.document.Document)1 DocumentAccessException (com.yahoo.documentapi.DocumentAccessException)1 LoadType (com.yahoo.documentapi.messagebus.loadtypes.LoadType)1 LoadTypeSet (com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet)1 BatchDocumentUpdateMessage (com.yahoo.documentapi.messagebus.protocol.BatchDocumentUpdateMessage)1 GetDocumentReply (com.yahoo.documentapi.messagebus.protocol.GetDocumentReply)1