use of com.yahoo.documentapi.messagebus.protocol.RemoveDocumentMessage in project vespa by vespa-engine.
the class DocumentOperationMessageV3 method newRemoveMessage.
static DocumentOperationMessageV3 newRemoveMessage(VespaXMLFeedReader.Operation op, String operationId) {
DocumentRemove remove = new DocumentRemove(op.getRemove());
remove.setCondition(op.getCondition());
Message msg = new RemoveDocumentMessage(remove);
String id = (operationId == null) ? remove.getId().toString() : operationId;
return new DocumentOperationMessageV3(id, msg);
}
use of com.yahoo.documentapi.messagebus.protocol.RemoveDocumentMessage in project vespa by vespa-engine.
the class Feeder method newRemoveMessage.
private Tuple2<String, Message> newRemoveMessage(Operation op, String operationId) {
DocumentRemove remove = new DocumentRemove(op.getRemove());
remove.setCondition(op.getCondition());
Message msg = new RemoveDocumentMessage(remove);
String id = (operationId == null) ? remove.getId().toString() : operationId;
return new Tuple2<>(id, msg);
}
use of com.yahoo.documentapi.messagebus.protocol.RemoveDocumentMessage in project vespa by vespa-engine.
the class MessageBusSyncSession method remove.
@Override
public boolean remove(DocumentRemove documentRemove, DocumentProtocol.Priority pri) {
RemoveDocumentMessage msg = new RemoveDocumentMessage(documentRemove.getId());
msg.setPriority(pri);
msg.setCondition(documentRemove.getCondition());
return remove(msg);
}
use of com.yahoo.documentapi.messagebus.protocol.RemoveDocumentMessage in project vespa by vespa-engine.
the class DumpVisitorDataHandler method onMessage.
@Override
public void onMessage(Message m, AckToken token) {
if (m instanceof PutDocumentMessage) {
PutDocumentMessage pm = (PutDocumentMessage) m;
onDocument(pm.getDocumentPut().getDocument(), pm.getTimestamp());
} else if (m instanceof RemoveDocumentMessage) {
RemoveDocumentMessage rm = (RemoveDocumentMessage) m;
onRemove(rm.getDocumentId());
} else {
throw new UnsupportedOperationException("Received unsupported message " + m.toString() + " to dump visitor data handler. This handler only accepts Put and Remove");
}
ack(token);
}
use of com.yahoo.documentapi.messagebus.protocol.RemoveDocumentMessage in project vespa by vespa-engine.
the class DummyReceiver method handleMessage.
public void handleMessage(Message message) {
messageCount++;
if (silentNum == 0) {
System.out.println("Received message " + message + ". Received " + messageCount + " messages so far. In queue size " + queue.size());
if (verbose) {
if (message instanceof PutDocumentMessage) {
System.out.println(" Document:\n" + ((PutDocumentMessage) message).getDocumentPut().getDocument().toXML(" "));
} else if (message instanceof RemoveDocumentMessage) {
System.out.println(" Document id: " + ((RemoveDocumentMessage) message).getDocumentId());
} else if (message instanceof UpdateDocumentMessage) {
System.out.println(" Update:\n " + ((UpdateDocumentMessage) message).getDocumentUpdate().toString());
}
}
} else {
if ((messageCount % silentNum) == 0) {
System.out.println("Received " + messageCount + " messages so far. In queue size " + queue.size());
}
}
EmptyReply reply = new EmptyReply();
message.swapState(reply);
if (!instant) {
try {
executor.execute(new Task(reply));
} catch (RejectedExecutionException e) {
reply.addError(new Error(ErrorCode.SESSION_BUSY, "Session " + name + "/default is busy"));
session.reply(reply);
}
} else {
session.reply(reply);
}
}
Aggregations