/** * {"pid":Xxx},{"$set":{"ack":false}} * * @param context * @param protocol * @return */ private boolean writeAndReturn(JIDContext context, Protocol protocol) { this.persistent.peek( MongoUtils.asMap( BasicDBObjectBuilder.start( Dictionary.FIELD_PID, protocol.cast(Message.class).getReceived().id()) .get()), MongoUtils.asMap( BasicDBObjectBuilder.start( "$set", BasicDBObjectBuilder.start(Dictionary.FIELD_ACK, false).get()) .get())); return false; }
public boolean trace(String id) { return MongoUtils.asBoolean( this.config .collection() .findAndModify( BasicDBObjectBuilder.start().add(Dictionary.FIELD_PID, id).get(), this.failed), Dictionary.FIELD_ACTIVATE, false); }
@Override public boolean trace(Tracer tracer) { return MongoUtils.effect( this.config .collection() .save( BasicDBObjectBuilder.start(tracer.plus()) .add(Dictionary.FIELD_PID, tracer.id()) .add(Dictionary.FIELD_FROM, tracer.initiator()) .add(Dictionary.FIELD_ACTIVATE, true) .add(Dictionary.FIELD_TO, tracer.target()) .add(Dictionary.FIELD_TIMESTAMP, System.currentTimeMillis()) .get(), WriteConcern.SAFE)); }
/* * {"id":Xxx} * * @see com.sissi.persistent.PersistentElement#query(com.sissi.protocol.Element) */ public Map<String, Object> query(Element element) { return MongoUtils.asMap( BasicDBObjectBuilder.start(Dictionary.FIELD_PID, element.getId()).get()); }