@Override public MongoConfig call() { boolean isMongos = isMongos(); List<Shard> shards = getShards(isMongos); MongoConfig config = new MongoConfig(isMongos, shards); return config; }
public MongoConfigProvider(MongoDBRiver river, MongoClientService mongoClientService) { super(river); this.mongoClientService = mongoClientService; this.definition = river.definition; this.clusterClient = mongoClientService.getMongoClusterClient(definition); }
private String addInsertToStream(final Timestamp<?> currentTimestamp, final DBObject data) throws InterruptedException { return addInsertToStream(currentTimestamp, data, definition.getMongoCollection()); }
public Indexer(MongoDBRiver river) { super(river); this.river = river; this.definition = river.definition; this.context = river.context; this.esClient = river.esClient; this.scriptService = river.scriptService; logger.debug( "Create bulk processor with parameters - bulk actions: {} - concurrent request: {} - flush interval: {} - bulk size: {}", definition.getBulk().getBulkActions(), definition.getBulk().getConcurrentRequests(), definition.getBulk() .getFlushInterval(), definition.getBulk().getBulkSize()); getBulkProcessor(definition.getIndexName(), definition.getTypeName()); }
MongoDBRiverBulkProcessor(MongoDBRiver river, MongoDBRiverDefinition definition, Client client, String index, String type) { super(river); this.river = river; this.bulkProcessor = BulkProcessor.builder(client, listener).setBulkActions(definition.getBulk().getBulkActions()) .setConcurrentRequests(definition.getBulk().getConcurrentRequests()) .setFlushInterval(definition.getBulk().getFlushInterval()).setBulkSize(definition.getBulk().getBulkSize()).build(); this.definition = definition; this.client = client; this.index = index; this.type = type; this.bulkQueueSize = getBulkQueueSize(); }
private DBCursor processFullOplog() throws InterruptedException, SlurperException { Timestamp<?> currentTimestamp = getCurrentOplogTimestamp(); return oplogCursor(currentTimestamp); }
private boolean hasScript() { return definition.getScriptType() != null && definition.getScript() != null; }
public String getMongoOplogNamespace() { return getMongoDb() + "." + getMongoCollection(); }
protected boolean riverHasIndexedFromOplog() { return MongoDBRiver.getLastTimestamp(esClient, definition) != null; }
protected boolean isIndexEmpty() { return MongoDBRiver.getIndexCount(esClient, definition) == 0; }
public MongoDBRiverBulkProcessor build() { return new MongoDBRiverBulkProcessor(river, definition, client, index, type); } }
/** * Builds a new bulk processor. */ public Bulk build() { return new Bulk(this); } }
public MongoDBRiverDefinition build() { return new MongoDBRiverDefinition(this); } }
public Builder initialTimestamp(BSONTimestamp initialTimestamp) { this.initialTimestamp = new Timestamp.BSON(initialTimestamp); return this; }
@SuppressWarnings({ "unchecked", "rawtypes" }) public static int compare(Timestamp oplogTimestamp, Timestamp startTimestamp) { return oplogTimestamp.compareTo(startTimestamp); }
/** Parse last timestamp field(s) from river source metadata. */ public static Timestamp<?> on(Map<String, Object> map) { return on(map, true); }
static String removePrefix(String prefix, String object) { return addRemovePrefix(prefix, object, false); }
protected Timestamp<?> getLastProcessedTimestamp() { return MongoDBRiver.getLastTimestamp(esClient, definition); }
protected boolean isIndexEmpty() { return MongoDBRiver.getIndexCount(esClient, definition) == 0; }