@Named @Dependent public class CassandraItemReader extends CassandraReaderWriterBase implements javax.batch.api.chunk.ItemReader
javax.batch.api.chunk.ItemReader
that reads data items from the Cassandra cluster.CassandraItemWriter
,
CassandraBatchlet
,
CassandraReaderWriterBase
Modifier and Type | Field and Description |
---|---|
protected com.datastax.driver.core.ColumnDefinitions |
columnDefinitions
The column definitions of the
ResultSet |
protected String[] |
columnLabels
The column names of the
ResultSet |
protected String[] |
columnMapping
String keys used in target data structure for database columns.
|
protected int |
currentRowNumber
The current row number.
|
protected int |
end
The row number in the
ResultSet to end reading (inclusive). |
protected Integer |
fetchSize
The query fetch size.
|
protected Map<String,PropertyDescriptor> |
propertyDescriptorMap
For
CassandraReaderWriterBase.beanType of custom POJO bean, this property defines a mapping
between POJO bean's property name and its JavaBeans java.beans.PropertyDescriptor . |
protected com.datastax.driver.core.ResultSet |
resultSet
The
com.datastax.driver.core.ResultSet from executing statement |
protected Iterator<com.datastax.driver.core.Row> |
rowIterator
The iterator of
com.datastax.driver.core.Row based on resultSet |
protected boolean |
skipBeanValidation
Whether to perform bean validation with Bean Validation API, if the
CassandraReaderWriterBase.beanType
is a custom POJO bean type. |
protected int |
start
The row number in the
ResultSet to start reading. |
protected com.datastax.driver.core.Statement |
statement
The regular cql statement based on
CassandraReaderWriterBase.cql |
beanType, cluster, clusterInstance, clusterProperties, contactPoints, cql, customCodecList, customCodecs, keyspace, password, propertyDescriptors, session, sessionCreated, sessionInstance, user
Constructor and Description |
---|
CassandraItemReader() |
Modifier and Type | Method and Description |
---|---|
Serializable |
checkpointInfo() |
protected void |
initBeanPropertyDescriptors() |
void |
open(Serializable checkpoint) |
Object |
readItem() |
applyClusterProperties, close, initCustomCodecs, initSession
@Inject protected int start
ResultSet
to start reading. It's a positive integer starting from 1.@Inject protected int end
ResultSet
to end reading (inclusive). It's a positive integer starting from 1.@Inject protected Integer fetchSize
com.datastax.driver.core.Statement#setFetchSize(int)
,
the fetch size controls how much resulting rows will be retrieved simultaneously
(the goal being to avoid loading too much results in memory for queries yielding large results).
Please note that while value as low as 1 can be used,
it is *highly* discouraged to use such a low value in practice as it will yield very poor performance.
If in doubt, leaving the default is probably a good idea.
Optional property, and defaults to null (not specified).@Inject protected String[] columnMapping
columnLabels
.
For example, if CassandraReaderWriterBase.cql
is
SELECT NAME, ADDRESS, AGE FROM PERSON
And you want to map the data to the following form:
{"fn" = "Jon", "addr" = "1 Main st", "age" = 30}
then columnMapping
should be specified as follows in job xml:
"fn, addr, age"
@Inject protected boolean skipBeanValidation
CassandraReaderWriterBase.beanType
is a custom POJO bean type. Optional property, and defaults to false
(perform bean validation).protected String[] columnLabels
ResultSet
protected com.datastax.driver.core.Statement statement
CassandraReaderWriterBase.cql
protected com.datastax.driver.core.ResultSet resultSet
com.datastax.driver.core.ResultSet
from executing statement
protected Iterator<com.datastax.driver.core.Row> rowIterator
com.datastax.driver.core.Row
based on resultSet
protected com.datastax.driver.core.ColumnDefinitions columnDefinitions
ResultSet
protected Map<String,PropertyDescriptor> propertyDescriptorMap
CassandraReaderWriterBase.beanType
of custom POJO bean, this property defines a mapping
between POJO bean's property name and its JavaBeans java.beans.PropertyDescriptor
.protected int currentRowNumber
public void open(Serializable checkpoint) throws Exception
open
in interface javax.batch.api.chunk.ItemReader
Exception
public Object readItem() throws Exception
readItem
in interface javax.batch.api.chunk.ItemReader
Exception
public Serializable checkpointInfo() throws Exception
checkpointInfo
in interface javax.batch.api.chunk.ItemReader
Exception
protected void initBeanPropertyDescriptors() throws IntrospectionException
initBeanPropertyDescriptors
in class CassandraReaderWriterBase
IntrospectionException
Copyright © 2018 JBoss by Red Hat. All rights reserved.