Class JdbcCursorItemReaderProperties
java.lang.Object
org.springframework.cloud.task.batch.autoconfigure.jdbc.JdbcCursorItemReaderProperties
@ConfigurationProperties(prefix="spring.batch.job.jdbccursoritemreader")
public class JdbcCursorItemReaderProperties
extends Object
- Since:
- 2.3
- Author:
- Michael Minella
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Provides the index of the current item.int
Provides the number of items to return each time the cursor fetches from the server.int
The maximum number of items to be read.int
Provides the maximum number of rows to read with this reader.getName()
Returns the configured value of the name used to calculateExecutionContext
keys.int
Provides the time in milliseconds for the query to timeout.getSql()
Returns the SQL query to be executed.boolean
Provides if the driver supports absolute positioning of a cursor.boolean
Provides if SQL warnings should be ignored.boolean
Returns the configured value of if the state of the reader will be persisted.boolean
Sets whether the connection used for the cursor is being used by all other processing and is, therefore, part of the same transaction.boolean
Indicates if the cursor's position should be validated with each item read (to confirm that the RowMapper has not moved the cursor's location).void
setCurrentItemCount
(int currentItemCount) Index for the current item.void
setDriverSupportsAbsolute
(boolean driverSupportsAbsolute) Sets if the driver supports absolute positioning of a cursor.void
setFetchSize
(int fetchSize) Sets the number of items to return each time the cursor fetches from the server.void
setIgnoreWarnings
(boolean ignoreWarnings) Sets if SQL warnings should be ignored.void
setMaxItemCount
(int maxItemCount) Configure the max number of items to be read.void
setMaxRows
(int maxRows) Sets the maximum number of rows to be read with this reader.void
The name used to calculate the key within theExecutionContext
.void
setQueryTimeout
(int queryTimeout) Sets the time in milliseconds for the query to timeout.void
setSaveState
(boolean saveState) Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.void
Sets the SQL query to be executed.void
setUseSharedExtendedConnection
(boolean useSharedExtendedConnection) Sets whether the the connection used for the cursor is being used by all other processing and is, therefore, part of the same transaction.void
setVerifyCursorPosition
(boolean verifyCursorPosition) Provides if the cursor's position should be validated with each item read.
-
Constructor Details
-
JdbcCursorItemReaderProperties
public JdbcCursorItemReaderProperties()
-
-
Method Details
-
isSaveState
public boolean isSaveState()Returns the configured value of if the state of the reader will be persisted.- Returns:
- true if the state will be persisted
-
setSaveState
public void setSaveState(boolean saveState) Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.- Parameters:
saveState
- defaults to true
-
getName
Returns the configured value of the name used to calculateExecutionContext
keys.- Returns:
- the name
-
setName
The name used to calculate the key within theExecutionContext
. Required ifsetSaveState(boolean)
is set to true.- Parameters:
name
- name of the reader instance- See Also:
-
ItemStreamSupport.setName(String)
-
getMaxItemCount
public int getMaxItemCount()The maximum number of items to be read.- Returns:
- the configured number of items, defaults to Integer.MAX_VALUE
-
setMaxItemCount
public void setMaxItemCount(int maxItemCount) Configure the max number of items to be read.- Parameters:
maxItemCount
- the max items to be read- See Also:
-
AbstractItemCountingItemStreamItemReader.setMaxItemCount(int)
-
getCurrentItemCount
public int getCurrentItemCount()Provides the index of the current item.- Returns:
- item index
-
setCurrentItemCount
public void setCurrentItemCount(int currentItemCount) Index for the current item. Also used on restarts to indicate where to start from.- Parameters:
currentItemCount
- current index- See Also:
-
AbstractItemCountingItemStreamItemReader.setCurrentItemCount(int)
-
getFetchSize
public int getFetchSize()Provides the number of items to return each time the cursor fetches from the server.- Returns:
- fetch size
-
setFetchSize
public void setFetchSize(int fetchSize) Sets the number of items to return each time the cursor fetches from the server.- Parameters:
fetchSize
- the number of items- See Also:
-
JdbcCursorItemReaderBuilder.fetchSize(int)
-
getMaxRows
public int getMaxRows()Provides the maximum number of rows to read with this reader.- Returns:
- maxiumum number of items
-
setMaxRows
public void setMaxRows(int maxRows) Sets the maximum number of rows to be read with this reader.- Parameters:
maxRows
- maximum number of items- See Also:
-
JdbcCursorItemReaderBuilder.maxRows(int)
-
getQueryTimeout
public int getQueryTimeout()Provides the time in milliseconds for the query to timeout.- Returns:
- milliseconds for the timeout
-
setQueryTimeout
public void setQueryTimeout(int queryTimeout) Sets the time in milliseconds for the query to timeout.- Parameters:
queryTimeout
- milliseconds- See Also:
-
JdbcCursorItemReaderBuilder.queryTimeout(int)
-
isIgnoreWarnings
public boolean isIgnoreWarnings()Provides if SQL warnings should be ignored.- Returns:
- true if warnings should be ignored
-
setIgnoreWarnings
public void setIgnoreWarnings(boolean ignoreWarnings) Sets if SQL warnings should be ignored.- Parameters:
ignoreWarnings
- indicator if the warnings should be ignored- See Also:
-
JdbcCursorItemReaderBuilder.ignoreWarnings(boolean)
-
isVerifyCursorPosition
public boolean isVerifyCursorPosition()Indicates if the cursor's position should be validated with each item read (to confirm that the RowMapper has not moved the cursor's location).- Returns:
- true if the position should be validated
-
setVerifyCursorPosition
public void setVerifyCursorPosition(boolean verifyCursorPosition) Provides if the cursor's position should be validated with each item read.- Parameters:
verifyCursorPosition
- true if the position should be validated- See Also:
-
JdbcCursorItemReaderBuilder.verifyCursorPosition(boolean)
-
isDriverSupportsAbsolute
public boolean isDriverSupportsAbsolute()Provides if the driver supports absolute positioning of a cursor.- Returns:
- true if the driver supports absolute positioning
-
setDriverSupportsAbsolute
public void setDriverSupportsAbsolute(boolean driverSupportsAbsolute) Sets if the driver supports absolute positioning of a cursor.- Parameters:
driverSupportsAbsolute
- true if the driver supports absolute positioning- See Also:
-
JdbcCursorItemReaderBuilder.driverSupportsAbsolute(boolean)
-
getSql
Returns the SQL query to be executed.- Returns:
- the SQL query
-
setSql
Sets the SQL query to be executed.- Parameters:
sql
- the query- See Also:
-
JdbcCursorItemReaderBuilder.sql(String)
-