Class XstreamStreamingChangeEventSource
- java.lang.Object
-
- io.debezium.connector.oracle.xstream.XstreamStreamingChangeEventSource
-
- All Implemented Interfaces:
ChangeEventSource,StreamingChangeEventSource<OraclePartition,OracleOffsetContext>
public class XstreamStreamingChangeEventSource extends Object implements StreamingChangeEventSource<OraclePartition,OracleOffsetContext>
AStreamingChangeEventSourcebased on Oracle's XStream API. The XStream event handler loop is executed in a separate executor.- Author:
- Gunnar Morling
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXstreamStreamingChangeEventSource.PositionAndScn-
Nested classes/interfaces inherited from interface io.debezium.pipeline.source.spi.ChangeEventSource
ChangeEventSource.ChangeEventSourceContext
-
-
Field Summary
Fields Modifier and Type Field Description private Clockclockprivate OracleConnectorConfigconnectorConfigprivate EventDispatcher<TableId>dispatcherprivate ErrorHandlererrorHandlerprivate OracleConnectionjdbcConnectionprivate AtomicReference<XstreamStreamingChangeEventSource.PositionAndScn>lcrMessageA message box between thread that is informed about committed offsets and the XStream thread.private static org.slf4j.LoggerLOGGERprivate intposVersionprivate OracleDatabaseSchemaschemaprivate OracleStreamingChangeEventSourceMetricsstreamingMetricsprivate oracle.streams.XStreamOutxsOutprivate StringxStreamServerName
-
Constructor Summary
Constructors Constructor Description XstreamStreamingChangeEventSource(OracleConnectorConfig connectorConfig, OracleConnection jdbcConnection, EventDispatcher<TableId> dispatcher, ErrorHandler errorHandler, Clock clock, OracleDatabaseSchema schema, OracleStreamingChangeEventSourceMetrics streamingMetrics)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommitOffset(Map<String,?> offset)private byte[]convertScnToPosition(Scn scn)voidexecute(ChangeEventSource.ChangeEventSourceContext context, OraclePartition partition, OracleOffsetContext offsetContext)(package private) oracle.streams.XStreamOutgetXsOut()(package private) XstreamStreamingChangeEventSource.PositionAndScnreceivePublishedPosition()private static intresolvePosVersion(OracleConnection connection, OracleConnectorConfig connectorConfig)private voidsendPublishedPosition(LcrPosition lcrPosition, Scn scn)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.debezium.pipeline.source.spi.StreamingChangeEventSource
executeIteration, init
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
connectorConfig
private final OracleConnectorConfig connectorConfig
-
jdbcConnection
private final OracleConnection jdbcConnection
-
dispatcher
private final EventDispatcher<TableId> dispatcher
-
errorHandler
private final ErrorHandler errorHandler
-
clock
private final Clock clock
-
schema
private final OracleDatabaseSchema schema
-
streamingMetrics
private final OracleStreamingChangeEventSourceMetrics streamingMetrics
-
xStreamServerName
private final String xStreamServerName
-
xsOut
private volatile oracle.streams.XStreamOut xsOut
-
posVersion
private final int posVersion
-
lcrMessage
private final AtomicReference<XstreamStreamingChangeEventSource.PositionAndScn> lcrMessage
A message box between thread that is informed about committed offsets and the XStream thread. When the last offset is committed its value is passed to the XStream thread and a watermark is set to signal which events were safely processed. This is important as setting watermark in a concurrent thread can lead to a deadlock due to an internal Oracle code locking.
-
-
Constructor Detail
-
XstreamStreamingChangeEventSource
public XstreamStreamingChangeEventSource(OracleConnectorConfig connectorConfig, OracleConnection jdbcConnection, EventDispatcher<TableId> dispatcher, ErrorHandler errorHandler, Clock clock, OracleDatabaseSchema schema, OracleStreamingChangeEventSourceMetrics streamingMetrics)
-
-
Method Detail
-
execute
public void execute(ChangeEventSource.ChangeEventSourceContext context, OraclePartition partition, OracleOffsetContext offsetContext) throws InterruptedException
- Specified by:
executein interfaceStreamingChangeEventSource<OraclePartition,OracleOffsetContext>- Throws:
InterruptedException
-
commitOffset
public void commitOffset(Map<String,?> offset)
- Specified by:
commitOffsetin interfaceStreamingChangeEventSource<OraclePartition,OracleOffsetContext>
-
convertScnToPosition
private byte[] convertScnToPosition(Scn scn)
-
getXsOut
oracle.streams.XStreamOut getXsOut()
-
sendPublishedPosition
private void sendPublishedPosition(LcrPosition lcrPosition, Scn scn)
-
receivePublishedPosition
XstreamStreamingChangeEventSource.PositionAndScn receivePublishedPosition()
-
resolvePosVersion
private static int resolvePosVersion(OracleConnection connection, OracleConnectorConfig connectorConfig)
-
-