use of com.yahoo.messagebus.Message in project vespa by vespa-engine.
the class DocumentOperationMessageV3 method newPutMessage.
static DocumentOperationMessageV3 newPutMessage(VespaXMLFeedReader.Operation op, String operationId) {
DocumentPut put = new DocumentPut(op.getDocument());
put.setCondition(op.getCondition());
Message msg = new PutDocumentMessage(put);
String id = (operationId == null) ? put.getId().toString() : operationId;
return new DocumentOperationMessageV3(id, msg);
}
use of com.yahoo.messagebus.Message in project vespa by vespa-engine.
the class Feeder method newErrorMessage.
private Tuple2<String, Message> newErrorMessage(String operationId, Exception e) {
Message m = new FeedErrorMessage(operationId);
Tuple2<String, Message> msg = new Tuple2<>(operationId, m);
Hop hop = new Hop();
hop.addDirective(new ErrorDirective(Exceptions.toMessageString(e)));
Route route = new Route();
route.addHop(hop);
m.setRoute(route);
return msg;
}
use of com.yahoo.messagebus.Message in project vespa by vespa-engine.
the class Feeder method newUpdateMessage.
private Tuple2<String, Message> newUpdateMessage(Operation op, String operationId) {
DocumentUpdate update = op.getDocumentUpdate();
update.setCondition(op.getCondition());
Message msg = new UpdateDocumentMessage(update);
String id = (operationId == null) ? update.getId().toString() : operationId;
return new Tuple2<>(id, msg);
}
use of com.yahoo.messagebus.Message in project vespa by vespa-engine.
the class Feeder method getNextMessage.
private Tuple2<String, Message> getNextMessage(String operationId) throws Exception {
VespaXMLFeedReader.Operation op = new VespaXMLFeedReader.Operation();
Tuple2<String, Message> msg;
getNextOperation(op);
switch(op.getType()) {
case DOCUMENT:
msg = newPutMessage(op, operationId);
break;
case REMOVE:
msg = newRemoveMessage(op, operationId);
break;
case UPDATE:
msg = newUpdateMessage(op, operationId);
break;
default:
// typical end of feed
return null;
}
log(LogLevel.DEBUG, "Successfully deserialized document id: ", msg.first);
return msg;
}
use of com.yahoo.messagebus.Message in project vespa by vespa-engine.
the class Feeder method newPutMessage.
private Tuple2<String, Message> newPutMessage(Operation op, String operationId) {
DocumentPut put = new DocumentPut(op.getDocument());
put.setCondition(op.getCondition());
Message msg = new PutDocumentMessage(put);
String id = (operationId == null) ? put.getId().toString() : operationId;
return new Tuple2<>(id, msg);
}
Aggregations