Class JdbcBatchingDataCaptureService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.jdbc.JdbcService
-
- com.adaptris.core.services.jdbc.JdbcServiceWithParameters
-
- com.adaptris.core.services.jdbc.JdbcDataCaptureServiceImpl
-
- com.adaptris.core.services.jdbc.JdbcIteratingDataCaptureServiceImpl
-
- com.adaptris.core.services.jdbc.JdbcBatchingDataCaptureService
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,ConnectedService
,MessageEventGenerator
,Service
,StateManagedComponent
@ComponentProfile(summary="Capture data from the message and store it in a database", tag="service,jdbc", recommended=DatabaseConnection.class) public class JdbcBatchingDataCaptureService extends JdbcIteratingDataCaptureServiceImpl
Capture Data from a AdaptrisMessage and store it in a JDBC-compliant database.There is probably little or no point in having batches if your underlying database connection has
auto-commit=true
. No checks on the underlingConnection
so ifDatabaseMetaData.supportsBatchUpdates()
is likely to return false, then results may be undefined.With a
setBatchWindow(Integer)
of 1, then it will be functionally equivalent toJdbcDataCaptureService
.If the
DocumentBuilderFactoryBuilder
has been explicitly set to be not namespace aware and the document does in fact contain namespaces, then Saxon can cause merry havoc in the sense that//NonNamespaceXpath
doesn't work if the document has namespaces in it. We have included a shim so that behaviour can be toggled based on what you have configured.- See Also:
XPath.newXPathInstance(DocumentBuilderFactoryBuilder, NamespaceContext)
,JdbcDataCaptureService
In the adapter configuration file this class is aliased as jdbc-batching-data-capture-service which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adaptris.core.services.jdbc.JdbcDataCaptureServiceImpl
JdbcDataCaptureServiceImpl.DatabaseActor
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_BATCH_WINDOW
-
Fields inherited from class com.adaptris.core.services.jdbc.JdbcDataCaptureServiceImpl
actor
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description JdbcBatchingDataCaptureService()
JdbcBatchingDataCaptureService(java.lang.String statement)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
executeUpdate(java.sql.PreparedStatement insert)
protected long
finishUpdate(java.sql.PreparedStatement insert)
java.lang.Integer
getBatchWindow()
protected static long
rowsUpdated(int[] rc)
void
setBatchWindow(java.lang.Integer i)
Set the batch window for operations.-
Methods inherited from class com.adaptris.core.services.jdbc.JdbcIteratingDataCaptureServiceImpl
doService, getIterates, getIterationXpath, getNamespaceContext, getXmlDocumentFactoryConfig, initJdbcService, setIterates, setIterationXpath, setNamespaceContext, setXmlDocumentFactoryConfig
-
Methods inherited from class com.adaptris.core.services.jdbc.JdbcDataCaptureServiceImpl
closeJdbcService, configureActor, getRowsUpdatedMetadataKey, getSaveReturnedKeys, getStatement, prepareService, saveKeys, saveReturnedKeys, setRowsUpdatedMetadataKey, setSaveReturnedKeys, setStatement, startService, stopService, updateMetadata
-
Methods inherited from class com.adaptris.core.services.jdbc.JdbcServiceWithParameters
addStatementParameter, getParameterApplicator, getStatementParameters, setParameterApplicator, setStatementParameters
-
Methods inherited from class com.adaptris.core.jdbc.JdbcService
applyTimeout, closeService, createStatement, getConnection, getConnection, getStatementTimeout, initService, prepare, prepareStatement, prepareStatement, setConnection, setStatementTimeout, start, stop
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpoint
-
Methods inherited from interface com.adaptris.core.Service
continueOnFailure, isBranching, setUniqueId
-
Methods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
-
-
-
Field Detail
-
DEFAULT_BATCH_WINDOW
public static final int DEFAULT_BATCH_WINDOW
- See Also:
- Constant Field Values
-
-
Method Detail
-
executeUpdate
protected long executeUpdate(java.sql.PreparedStatement insert) throws java.sql.SQLException
- Specified by:
executeUpdate
in classJdbcIteratingDataCaptureServiceImpl
- Throws:
java.sql.SQLException
-
finishUpdate
protected long finishUpdate(java.sql.PreparedStatement insert) throws java.sql.SQLException
- Specified by:
finishUpdate
in classJdbcIteratingDataCaptureServiceImpl
- Throws:
java.sql.SQLException
-
getBatchWindow
public java.lang.Integer getBatchWindow()
- Returns:
- the batchWindow
-
setBatchWindow
public void setBatchWindow(java.lang.Integer i)
Set the batch window for operations.- Parameters:
i
- the batchWindow to set; default is 1024 if not specified.
-
rowsUpdated
protected static long rowsUpdated(int[] rc) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
-