public class SimpleRiverFlow<RC extends RiverContext> extends Object implements RiverFlow<RC>
Constructor and Description |
---|
SimpleRiverFlow() |
Modifier and Type | Method and Description |
---|---|
protected void |
afterFetch(RiverContext riverContext)
After the river task has completed a single run, this method is called.
|
protected void |
beforeFetch(RC riverContext)
Before a river task (or river run) starts, this method is called.
|
protected RiverMouth |
createRiverMouth(Map<String,Object> params) |
protected RiverSource |
createRiverSource(Map<String,Object> params) |
void |
execute(RC riverContext)
Execute this river flow
|
protected void |
fetch(RiverContext riverContext)
After river context and state setup, when data should be fetched from river source, this method is called.
|
protected RC |
fillRiverContext(RC riverContext,
RiverState state,
RiverSource riverSource,
RiverMouth riverMouth) |
org.elasticsearch.client.Client |
getClient()
Get the client
|
org.elasticsearch.common.metrics.MeterMetric |
getMetric()
Get metric
|
Queue<RiverContext> |
getQueue()
Get queue for RiverContext processing
|
org.elasticsearch.river.RiverName |
getRiverName()
Gets the river name
|
org.elasticsearch.common.settings.Settings |
getSettings()
Get the settings
|
void |
logMetrics(RiverContext riverContext,
String cause)
Log metrics
|
SimpleRiverFlow<RC> |
newInstance() |
RC |
newRiverContext()
Create a new river context for a river run
|
RiverFlow |
setClient(org.elasticsearch.client.Client client) |
RiverFlow |
setIngestFactory(IngestFactory ingestFactory)
Set ingest factory
|
RiverFlow |
setMetric(org.elasticsearch.common.metrics.MeterMetric meterMetric)
Set metric
|
RiverFlow |
setQueue(Queue<RiverContext> queue)
Set queue for processing RiverContext requests
|
RiverFlow |
setRiverName(org.elasticsearch.river.RiverName riverName)
Sets the river name
|
RiverFlow |
setSettings(org.elasticsearch.common.settings.Settings settings)
Set the settings
|
String |
strategy()
The name of the strategy the river flow belongs to
|
public SimpleRiverFlow()
public String strategy()
RiverFlow
strategy
in interface RiverFlow<RC extends RiverContext>
public SimpleRiverFlow<RC> newInstance()
newInstance
in interface RiverFlow<RC extends RiverContext>
public RC newRiverContext()
RiverFlow
newRiverContext
in interface RiverFlow<RC extends RiverContext>
public RiverFlow setRiverName(org.elasticsearch.river.RiverName riverName)
RiverFlow
setRiverName
in interface RiverFlow<RC extends RiverContext>
riverName
- the river namepublic org.elasticsearch.river.RiverName getRiverName()
RiverFlow
getRiverName
in interface RiverFlow<RC extends RiverContext>
public RiverFlow setSettings(org.elasticsearch.common.settings.Settings settings)
RiverFlow
setSettings
in interface RiverFlow<RC extends RiverContext>
settings
- the settingspublic org.elasticsearch.common.settings.Settings getSettings()
RiverFlow
getSettings
in interface RiverFlow<RC extends RiverContext>
public RiverFlow setIngestFactory(IngestFactory ingestFactory)
RiverFlow
setIngestFactory
in interface RiverFlow<RC extends RiverContext>
ingestFactory
- ingest factorypublic RiverFlow setClient(org.elasticsearch.client.Client client)
setClient
in interface RiverFlow<RC extends RiverContext>
public org.elasticsearch.client.Client getClient()
RiverFlow
getClient
in interface RiverFlow<RC extends RiverContext>
public void execute(RC riverContext) throws Exception
RiverFlow
execute
in interface RiverFlow<RC extends RiverContext>
Exception
protected void beforeFetch(RC riverContext) throws Exception
Exception
protected void fetch(RiverContext riverContext) throws Exception
Exception
public RiverFlow setMetric(org.elasticsearch.common.metrics.MeterMetric meterMetric)
RiverFlow
setMetric
in interface RiverFlow<RC extends RiverContext>
meterMetric
- the meter metricpublic org.elasticsearch.common.metrics.MeterMetric getMetric()
RiverFlow
getMetric
in interface RiverFlow<RC extends RiverContext>
public RiverFlow setQueue(Queue<RiverContext> queue)
RiverFlow
setQueue
in interface RiverFlow<RC extends RiverContext>
queue
- the queuepublic Queue<RiverContext> getQueue()
RiverFlow
getQueue
in interface RiverFlow<RC extends RiverContext>
protected void afterFetch(RiverContext riverContext) throws Exception
Exception
protected RiverSource createRiverSource(Map<String,Object> params)
protected RiverMouth createRiverMouth(Map<String,Object> params) throws IOException
IOException
protected RC fillRiverContext(RC riverContext, RiverState state, RiverSource riverSource, RiverMouth riverMouth) throws IOException
IOException
public void logMetrics(RiverContext riverContext, String cause)
RiverFlow
logMetrics
in interface RiverFlow<RC extends RiverContext>
cause
- the cause why metrics are loggedelasticsearch-river-jdbc