public class BulkIndexComputation extends AbstractComputation implements org.elasticsearch.action.bulk.BulkProcessor.Listener
Note that the retry policy is handled by the elasticsearch bulk processor.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
abort |
protected org.elasticsearch.action.bulk.BulkProcessor |
bulkProcessor |
protected Codec<DataBucket> |
codec |
protected boolean |
continueOnFailure |
protected int |
esBulkActions |
protected int |
esBulkSize |
protected int |
flushIntervalMs |
static String |
NAME |
protected boolean |
updates |
| Constructor and Description |
|---|
BulkIndexComputation(int esBulkSize,
int esBulkActions,
int flushInterval) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterBulk(long executionId,
org.elasticsearch.action.bulk.BulkRequest request,
org.elasticsearch.action.bulk.BulkResponse response) |
void |
afterBulk(long executionId,
org.elasticsearch.action.bulk.BulkRequest request,
Throwable failure) |
void |
beforeBulk(long executionId,
org.elasticsearch.action.bulk.BulkRequest request) |
protected org.elasticsearch.action.bulk.BulkRequest |
decodeRequest(DataBucket bucket) |
void |
destroy()
Called when the framework is ready to shutdown the computation.
|
protected ESClient |
getESClient() |
void |
init(ComputationContext context)
Called when the framework has registered the computation successfully.
|
void |
processRecord(ComputationContext context,
String inputStream,
Record record)
Process an incoming record on one of the computation's input streams.
|
void |
processTimer(ComputationContext context,
String key,
long timestamp)
Process a timer callback previously set via
ComputationContext.setTimer(String, long). |
metadata, processFailure, processRetryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsignalStoppublic static final String NAME
protected final int esBulkSize
protected final int esBulkActions
protected final int flushIntervalMs
protected org.elasticsearch.action.bulk.BulkProcessor bulkProcessor
protected Codec<DataBucket> codec
protected boolean updates
protected boolean continueOnFailure
protected volatile boolean abort
public BulkIndexComputation(int esBulkSize, int esBulkActions, int flushInterval)
public void init(ComputationContext context)
Computationinit in interface Computationinit in class AbstractComputationcontext - The computation context object provided by the system.public void processTimer(ComputationContext context, String key, long timestamp)
ComputationComputationContext.setTimer(String, long).processTimer in interface ComputationprocessTimer in class AbstractComputationcontext - The computation context object provided by the system.key - The name of the timer.timestamp - The timestamp (in ms) for which the callback was scheduled.public void processRecord(ComputationContext context, String inputStream, Record record)
ComputationprocessRecord in interface Computationcontext - The computation context object provided by the system.inputStream - Name of the input stream that provides the record.record - The record.public void destroy()
Computationdestroy in interface Computationprotected ESClient getESClient()
protected org.elasticsearch.action.bulk.BulkRequest decodeRequest(DataBucket bucket)
public void beforeBulk(long executionId, org.elasticsearch.action.bulk.BulkRequest request)
beforeBulk in interface org.elasticsearch.action.bulk.BulkProcessor.Listenerpublic void afterBulk(long executionId, org.elasticsearch.action.bulk.BulkRequest request, org.elasticsearch.action.bulk.BulkResponse response)
afterBulk in interface org.elasticsearch.action.bulk.BulkProcessor.ListenerCopyright © 2019 Nuxeo. All rights reserved.