Search in sources :

Example 1 with VespaXMLFeedReader

use of com.yahoo.vespaxmlparser.VespaXMLFeedReader in project vespa by vespa-engine.

the class SimpleFeeder method run.

public SimpleFeeder run() throws Throwable {
    VespaXMLFeedReader reader = new VespaXMLFeedReader(in, docTypeMgr);
    VespaXMLFeedReader.Operation op = new VespaXMLFeedReader.Operation();
    printHeader();
    while (failure == null) {
        reader.read(op);
        if (op.getType() == VespaXMLFeedReader.OperationType.INVALID) {
            break;
        }
        Message msg = newMessage(op);
        if (msg == null) {
            err.println("ignoring operation; " + op.getType());
            // ignore
            continue;
        }
        msg.setContext(System.currentTimeMillis());
        msg.setRoute(route);
        Error err = session.sendBlocking(msg).getError();
        if (err != null) {
            throw new IOException(err.toString());
        }
        ++numMessages;
    }
    while (failure == null && numReplies < numMessages) {
        Thread.sleep(100);
    }
    if (failure != null) {
        throw failure;
    }
    printReport();
    return this;
}
Also used : VespaXMLFeedReader(com.yahoo.vespaxmlparser.VespaXMLFeedReader) Message(com.yahoo.messagebus.Message) Error(com.yahoo.messagebus.Error) IOException(java.io.IOException)

Aggregations

Error (com.yahoo.messagebus.Error)1 Message (com.yahoo.messagebus.Message)1 VespaXMLFeedReader (com.yahoo.vespaxmlparser.VespaXMLFeedReader)1 IOException (java.io.IOException)1