public interface RiverSource<RC extends RiverContext>
Modifier and Type | Method and Description |
---|---|
void |
afterFetch()
Executed after fetch() has been executed or threw an exception.
|
void |
afterRows(ResultSet results,
KeyValueStreamListener listener)
Executed after all rows have been fetched from result set
|
void |
afterRows(SQLCommand command,
ResultSet results,
KeyValueStreamListener listener)
After the result set is processed, this method is called.
|
void |
beforeFetch()
Executed before fetch() is executed
|
void |
beforeRows(ResultSet results,
KeyValueStreamListener listener)
Executed before rows are fetched from result set
|
void |
beforeRows(SQLCommand command,
ResultSet results,
KeyValueStreamListener listener)
This routine is executed before the result set is evaluated
|
RiverSource |
bind(PreparedStatement statement,
List<Object> values)
Bind query variables
|
RiverSource |
close(ResultSet result)
Close result set
|
RiverSource |
close(Statement statement)
Close statement
|
RiverSource |
closeReading()
Close reading from this river source
|
RiverSource |
closeWriting()
Close writing to this river source
|
ResultSet |
executeQuery(PreparedStatement statement)
Execute query
|
ResultSet |
executeQuery(Statement statement,
String sql)
Execute query without binding parameters
|
RiverSource |
executeUpdate(PreparedStatement statement)
Execute insert/update
|
RiverSource |
executeUpdate(Statement statement,
String sql)
Execute insert update
|
void |
fetch()
Fetch a data portion from the database and pass it to the river task
for firther processing.
|
Connection |
getConnectionForReading()
Get a connection for reading data
|
Connection |
getConnectionForWriting()
Get a connection for writing data
|
Locale |
getLocale()
Get the current locale
|
TimeZone |
getTimeZone()
Get the current timezone of this river source for the JDBC setTimestamp() call
|
RiverSource<RC> |
newInstance()
Create new river source instance
|
boolean |
nextRow(ResultSet results,
KeyValueStreamListener listener)
Executed when next row is fetched from result set
|
boolean |
nextRow(SQLCommand command,
ResultSet results,
KeyValueStreamListener listener)
Action for the next row of the result set to be processed
|
Object |
parseType(ResultSet results,
Integer num,
int type,
Locale locale)
Parse a value in a row column
|
PreparedStatement |
prepareQuery(String sql)
Prepare query statement
|
PreparedStatement |
prepareUpdate(String sql)
Prepare insert/update statement
|
RiverSource |
register(CallableStatement statement,
Map<String,Object> values)
Register output variables for callable statement
|
void |
resume()
Resume river source
|
RiverSource |
setLocale(Locale locale)
Set the locale for JDBC
|
RiverSource |
setPassword(String password)
Set the password authentication
|
RiverSource |
setRiverContext(RC context)
Set the river context
|
RiverSource |
setTimeZone(TimeZone timeZone)
Set the timezone for JDBC setTimestamp() calls with calendar object.
|
RiverSource |
setUrl(String url)
Set JDBC connection URL
|
RiverSource |
setUser(String user)
Set the user authentication
|
void |
shutdown()
Shutdown source
|
String |
strategy()
The strategy this river source supports.
|
void |
suspend()
Suspend river source
|
String strategy()
RiverSource<RC> newInstance()
RiverSource setRiverContext(RC context)
context
- the contextvoid beforeFetch() throws Exception
Exception
void fetch() throws Exception
Exception
- when execution gives an errorvoid afterFetch() throws Exception
Exception
RiverSource setUrl(String url)
url
- the JDBC connection URLRiverSource setUser(String user)
user
- the userRiverSource setPassword(String password)
password
- the passwordConnection getConnectionForReading() throws SQLException
SQLException
- when SQL execution gives an errorConnection getConnectionForWriting() throws SQLException
SQLException
- when SQL execution gives an errorPreparedStatement prepareQuery(String sql) throws SQLException
sql
- SQL statementSQLException
- when SQL execution gives an errorPreparedStatement prepareUpdate(String sql) throws SQLException
sql
- SQL statementSQLException
- when SQL execution gives an errorRiverSource bind(PreparedStatement statement, List<Object> values) throws SQLException
statement
- prepared statementvalues
- valuesSQLException
- when SQL execution gives an errorRiverSource register(CallableStatement statement, Map<String,Object> values) throws SQLException
statement
- callable statementvalues
- valuesSQLException
- when SQL execution gives an errorResultSet executeQuery(PreparedStatement statement) throws SQLException
statement
- prepared statementSQLException
- when SQL execution gives an errorResultSet executeQuery(Statement statement, String sql) throws SQLException
statement
- the SQL statementsql
- the SQL querySQLException
- when SQL execution gives an errorRiverSource executeUpdate(PreparedStatement statement) throws SQLException
statement
- statementSQLException
- when SQL execution gives an errorRiverSource executeUpdate(Statement statement, String sql) throws SQLException
statement
- statementsql
- SQL querySQLException
void beforeRows(ResultSet results, KeyValueStreamListener listener) throws SQLException, IOException
results
- the result setlistener
- a result set listener or nullSQLException
IOException
boolean nextRow(ResultSet results, KeyValueStreamListener listener) throws SQLException, IOException
results
- the result setlistener
- a result set listener or nullSQLException
IOException
void afterRows(ResultSet results, KeyValueStreamListener listener) throws SQLException, IOException
results
- the result setlistener
- a result set listener or nullSQLException
IOException
void beforeRows(SQLCommand command, ResultSet results, KeyValueStreamListener listener) throws SQLException, IOException
command
- the SQL command that created this result setresults
- the result setlistener
- listener for the key/value stream generated from the result setSQLException
IOException
boolean nextRow(SQLCommand command, ResultSet results, KeyValueStreamListener listener) throws SQLException, IOException
results
- resultlistener
- listenerSQLException
- when SQL execution gives an errorIOException
- when input/output error occursvoid afterRows(SQLCommand command, ResultSet results, KeyValueStreamListener listener) throws SQLException, IOException
command
- the SQL command that created this result setresults
- the result setlistener
- listener for the key/value stream generated from the result setSQLException
IOException
Object parseType(ResultSet results, Integer num, int type, Locale locale) throws SQLException, IOException, ParseException
results
- result setnum
- positiontype
- typelocale
- localeSQLException
- when SQL execution gives an errorIOException
- when input/output error occursParseException
- if number format could not be parsedRiverSource close(ResultSet result) throws SQLException
result
- result setSQLException
- when SQL execution gives an errorRiverSource close(Statement statement) throws SQLException
statement
- statementSQLException
- when SQL execution gives an errorRiverSource closeReading()
RiverSource closeWriting()
RiverSource setLocale(Locale locale)
locale
- localeRiverSource setTimeZone(TimeZone timeZone)
timeZone
- the time zoneTimeZone getTimeZone()
void shutdown() throws IOException
IOException
elasticsearch-river-jdbc