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, processRetry
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
signalStop
public 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)
Computation
init
in interface Computation
init
in class AbstractComputation
context
- The computation context object provided by the system.public void processTimer(ComputationContext context, String key, long timestamp)
Computation
ComputationContext.setTimer(String, long)
.processTimer
in interface Computation
processTimer
in class AbstractComputation
context
- 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)
Computation
processRecord
in interface Computation
context
- The computation context object provided by the system.inputStream
- Name of the input stream that provides the record.record
- The record.public void destroy()
Computation
destroy
in interface Computation
protected 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.Listener
public void afterBulk(long executionId, org.elasticsearch.action.bulk.BulkRequest request, org.elasticsearch.action.bulk.BulkResponse response)
afterBulk
in interface org.elasticsearch.action.bulk.BulkProcessor.Listener
Copyright © 2019 Nuxeo. All rights reserved.