Interface ChangeStreamRecordAdapter.ChangeStreamRecordBuilder<ChangeStreamRecordT> (2.32.0)

public static interface ChangeStreamRecordAdapter.ChangeStreamRecordBuilder<ChangeStreamRecordT>

A SAX style change stream record factory. It is responsible for creating one of the three types of change stream record: heartbeat, close stream, and a change stream mutation.

State management is handled external to the implementation of this class:

    Case 1: Heartbeat
  1. Exactly 1 onHeartbeat.
    Case 2: CloseStream
  1. Exactly 1 onCloseStream.
    Case 3: ChangeStreamMutation. A change stream mutation consists of one or more mods, where the SetCells might be chunked. There are 3 different types of mods that a ReadChangeStream response can have:
  1. DeleteFamily -> Exactly 1 deleteFamily
  2. DeleteCell -> Exactly 1 deleteCell
  3. SetCell -> Exactly 1 startCell, At least 1 CellValue, Exactly 1 finishCell.

The whole flow of constructing a ChangeStreamMutation is:

  1. Exactly 1 startUserMutation or startGcMutation.
  2. At least 1 DeleteFamily/DeleteCell/SetCell mods.
  3. Exactly 1 finishChangeStreamMutation.

Note: For a non-chunked SetCell, only 1 CellValue will be called. For a chunked SetCell, more than 1 CellValues will be called.

Note: DeleteRow's won't appear in data changes since they'll be converted to multiple DeleteFamily's.

Type Parameter

NameDescription
ChangeStreamRecordT

Methods

cellValue(ByteString value)

public abstract void cellValue(ByteString value)

Called once per non-chunked cell, or at least twice per chunked cell to concatenate the cell value.

Parameter
NameDescription
valueByteString

deleteCells(String familyName, ByteString qualifier, Range.TimestampRange timestampRange)

public abstract void deleteCells(String familyName, ByteString qualifier, Range.TimestampRange timestampRange)

Called to add a DeleteCell mod.

Parameters
NameDescription
familyNameString
qualifierByteString
timestampRangeRange.TimestampRange

deleteFamily(String familyName)

public abstract void deleteFamily(String familyName)

Called to add a DeleteFamily mod.

Parameter
NameDescription
familyNameString

finishCell()

public abstract void finishCell()

Called once per cell to signal the end of the value (unless reset).

finishChangeStreamMutation(String token, Instant estimatedLowWatermark)

public abstract ChangeStreamRecordT finishChangeStreamMutation(String token, Instant estimatedLowWatermark)

Called once per stream record to signal that all mods have been processed (unless reset).

Parameters
NameDescription
tokenString
estimatedLowWatermarkorg.threeten.bp.Instant
Returns
TypeDescription
ChangeStreamRecordT

onCloseStream(ReadChangeStreamResponse.CloseStream closeStream)

public abstract ChangeStreamRecordT onCloseStream(ReadChangeStreamResponse.CloseStream closeStream)

Called to create a close stream message. This will be called at most once. If called, the current change stream record must not include any data changes or heartbeats.

Parameter
NameDescription
closeStreamcom.google.bigtable.v2.ReadChangeStreamResponse.CloseStream
Returns
TypeDescription
ChangeStreamRecordT

onHeartbeat(ReadChangeStreamResponse.Heartbeat heartbeat)

public abstract ChangeStreamRecordT onHeartbeat(ReadChangeStreamResponse.Heartbeat heartbeat)

Called to create a heartbeat. This will be called at most once. If called, the current change stream record must not include any data changes or close stream messages.

Parameter
NameDescription
heartbeatcom.google.bigtable.v2.ReadChangeStreamResponse.Heartbeat
Returns
TypeDescription
ChangeStreamRecordT

reset()

public abstract void reset()

Called when the current in progress change stream record should be dropped

startCell(String family, ByteString qualifier, long timestampMicros)

public abstract void startCell(String family, ByteString qualifier, long timestampMicros)

Called to start a SetCell.

    In case of a non-chunked cell, the following order is guaranteed:
  1. Exactly 1 startCell.
  2. Exactly 1 cellValue.
  3. Exactly 1 finishCell.
    In case of a chunked cell, the following order is guaranteed:
  1. Exactly 1 startCell.
  2. At least 2 cellValue.
  3. Exactly 1 finishCell.
Parameters
NameDescription
familyString
qualifierByteString
timestampMicroslong

startGcMutation(ByteString rowKey, Instant commitTimestamp, int tieBreaker)

public abstract void startGcMutation(ByteString rowKey, Instant commitTimestamp, int tieBreaker)

Called to start a new Garbage Collection ChangeStreamMutation. This will be called at most once. If called, the current change stream record must not include any close stream message or heartbeat.

Parameters
NameDescription
rowKeyByteString
commitTimestamporg.threeten.bp.Instant
tieBreakerint

startUserMutation(ByteString rowKey, String sourceClusterId, Instant commitTimestamp, int tieBreaker)

public abstract void startUserMutation(ByteString rowKey, String sourceClusterId, Instant commitTimestamp, int tieBreaker)

Called to start a new user initiated ChangeStreamMutation. This will be called at most once. If called, the current change stream record must not include any close stream message or heartbeat.

Parameters
NameDescription
rowKeyByteString
sourceClusterIdString
commitTimestamporg.threeten.bp.Instant
tieBreakerint