Returns a source which connects to the specified database using the given
connectionSupplier, queries the database and creates a result set
using the the given
resultSetFn. It creates output objects from the
ResultSet using given
mapOutputFn and emits them to
downstream.
resultSetFn gets the created connection, total parallelism (local
parallelism * member count) and global processor index as arguments and
produces a result set. The parallelism and processor index arguments
should be used to fetch a part of the whole result set specific to the
processor. If the table itself isn't partitioned by the same key, then
running multiple queries might not really be faster than using the
#jdbc(String,String,DistributedFunction) of this method, do your own testing.
createOutputFn gets the
ResultSet and creates desired
output object. The function is called for each row of the result set,
user should not call
ResultSet#next() or any other
cursor-navigating functions.
Example:
p.drawFrom(Sources.jdbc(,
resultSet -> new Person(resultSet.getInt(1), resultSet.getString(2))))
}
If the underlying table is modified while being read, the source may
miss and/or duplicate some entries, because multiple queries for parts
of the data on multiple members will be executed.
The source does not save any state to snapshot. If the job is restarted,
it will re-emit all entries.
Any
SQLException will cause the job to fail.
The default local parallelism for this processor is 1.