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>
A
StreamingChangeEventSource based on Oracle's XStream API. The XStream event handler loop is executed in a
separate executor.- Author:
- Gunnar Morling
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface io.debezium.pipeline.source.spi.ChangeEventSource
ChangeEventSource.ChangeEventSourceContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DelayStrategyprivate final Clockprivate final OracleConnectorConfigprivate static final intprivate static final intprivate final EventDispatcher<OraclePartition,TableId> private OracleOffsetContextprivate final ErrorHandlerprivate final OracleConnectionprivate final AtomicReference<XstreamStreamingChangeEventSource.PositionAndScn>A message box between thread that is informed about committed offsets and the XStream thread.private static final org.slf4j.Loggerprivate final intprivate final OracleDatabaseSchemaprivate final XStreamStreamingChangeEventSourceMetricsprivate oracle.streams.XStreamOutprivate final String -
Constructor Summary
ConstructorsConstructorDescriptionXstreamStreamingChangeEventSource(OracleConnectorConfig connectorConfig, OracleConnection jdbcConnection, EventDispatcher<OraclePartition, TableId> dispatcher, ErrorHandler errorHandler, Clock clock, OracleDatabaseSchema schema, XStreamStreamingChangeEventSourceMetrics streamingMetrics) -
Method Summary
Modifier and TypeMethodDescriptionvoidcommitOffset(Map<String, ?> partition, Map<String, ?> offset) private byte[]convertScnToPosition(Scn scn) private OracleOffsetContextvoidexecute(ChangeEventSource.ChangeEventSourceContext context, OraclePartition partition, OracleOffsetContext offsetContext) (package private) oracle.streams.XStreamOutgetXsOut()voidinit(OracleOffsetContext offsetContext) private booleanisAttachExceptionRetriable(oracle.streams.StreamsException e) private oracle.streams.XStreamOutperformAttachWithRetries(OracleConnection xsConnection, byte[] startPosition) (package private) XstreamStreamingChangeEventSource.PositionAndScnprivate 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, waitMethods inherited from interface io.debezium.pipeline.source.spi.StreamingChangeEventSource
executeIteration
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
DEFAULT_MAX_ATTACH_RETRIES
private static final int DEFAULT_MAX_ATTACH_RETRIES- See Also:
-
DEFAULT_MAX_ATTACH_RETRY_DELAY_SECONDS
private static final int DEFAULT_MAX_ATTACH_RETRY_DELAY_SECONDS- See Also:
-
connectorConfig
-
jdbcConnection
-
dispatcher
-
errorHandler
-
clock
-
schema
-
streamingMetrics
-
xStreamServerName
-
xsOut
private volatile oracle.streams.XStreamOut xsOut -
posVersion
private final int posVersion -
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. -
attachRetryStrategy
-
effectiveOffset
-
-
Constructor Details
-
XstreamStreamingChangeEventSource
public XstreamStreamingChangeEventSource(OracleConnectorConfig connectorConfig, OracleConnection jdbcConnection, EventDispatcher<OraclePartition, TableId> dispatcher, ErrorHandler errorHandler, Clock clock, OracleDatabaseSchema schema, XStreamStreamingChangeEventSourceMetrics streamingMetrics)
-
-
Method Details
-
init
- Specified by:
initin interfaceStreamingChangeEventSource<OraclePartition,OracleOffsetContext> - Throws:
InterruptedException
-
emptyContext
-
execute
public void execute(ChangeEventSource.ChangeEventSourceContext context, OraclePartition partition, OracleOffsetContext offsetContext) throws InterruptedException - Specified by:
executein interfaceStreamingChangeEventSource<OraclePartition,OracleOffsetContext> - Throws:
InterruptedException
-
commitOffset
- Specified by:
commitOffsetin interfaceStreamingChangeEventSource<OraclePartition,OracleOffsetContext>
-
getOffsetContext
- Specified by:
getOffsetContextin interfaceStreamingChangeEventSource<OraclePartition,OracleOffsetContext>
-
performAttachWithRetries
private oracle.streams.XStreamOut performAttachWithRetries(OracleConnection xsConnection, byte[] startPosition) throws Exception - Throws:
Exception
-
isAttachExceptionRetriable
private boolean isAttachExceptionRetriable(oracle.streams.StreamsException e) -
convertScnToPosition
-
getXsOut
oracle.streams.XStreamOut getXsOut() -
sendPublishedPosition
-
receivePublishedPosition
XstreamStreamingChangeEventSource.PositionAndScn receivePublishedPosition() -
resolvePosVersion
private static int resolvePosVersion(OracleConnection connection, OracleConnectorConfig connectorConfig)
-