public ElasticsearchWorkProcessor(BuildContext context, ElasticsearchClient client, GsonProvider gsonProvider, ElasticsearchWorkFactory workFactory) { this.errorHandler = context.getErrorHandler(); this.client = client; this.gsonProvider = gsonProvider; this.workFactory = workFactory; this.parallelWorkExecutionContext = new ImmutableElasticsearchWorkExecutionContext( client, gsonProvider ); /* * The following orchestrator doesn't require a strict execution ordering * (because it's mainly used by the mass indexer, which already takes care of * ordering works properly and waiting for pending works when necessary). * Thus we use a parallel orchestrator to maximize throughput. * Also, since works are not applied in order, and since API users have no way * to determine whether a work finished or not, explicit refreshes are useless, * so we disable refreshes both in the bulk API call and in the execution contexts. */ this.streamOrchestrator = createBatchingSharedOrchestrator( "Elasticsearch stream work orchestrator", STREAM_MAX_CHANGESETS_PER_BATCH, false, // Do not care about ordering when queuing changesets createParallelOrchestrator( this::createIndexMonitorBufferingWorkExecutionContext, STREAM_MIN_BULK_SIZE, false ) ); }
public ElasticsearchWorkProcessor(BuildContext context, ElasticsearchClient client, GsonProvider gsonProvider, ElasticsearchWorkFactory workFactory) { this.errorHandler = context.getErrorHandler(); this.client = client; this.gsonProvider = gsonProvider; this.workFactory = workFactory; this.parallelWorkExecutionContext = new ImmutableElasticsearchWorkExecutionContext( client, gsonProvider ); /* * The following orchestrator doesn't require a strict execution ordering * (because it's mainly used by the mass indexer, which already takes care of * ordering works properly and waiting for pending works when necessary). * Thus we use a parallel orchestrator to maximize throughput. * Also, since works are not applied in order, and since API users have no way * to determine whether a work finished or not, explicit refreshes are useless, * so we disable refreshes both in the bulk API call and in the execution contexts. */ this.streamOrchestrator = createBatchingSharedOrchestrator( "Elasticsearch stream work orchestrator", STREAM_MAX_CHANGESETS_PER_BATCH, false, // Do not care about ordering when queuing changesets createParallelOrchestrator( this::createIndexMonitorBufferingWorkExecutionContext, STREAM_MIN_BULK_SIZE, false ) ); }