# Interface ChangeStreamRecordAdapter.ChangeStreamRecordBuilder&lt;ChangeStreamRecordT&gt; (2.79.0)

2.79.0 (latest) 2.78.1 2.77.0 2.74.0 2.73.0 2.72.0 2.71.0 2.70.0 2.68.0 2.67.1 2.66.0 2.65.1 2.63.0 2.62.0 2.61.0 2.60.0 2.59.0 2.58.2 2.56.0 2.54.0 2.52.0 2.51.2 2.49.0 2.46.0 2.45.1 2.44.1 2.43.0 2.42.0 2.40.0 2.39.5 2.37.0 2.35.1 2.34.0 2.33.0 2.32.0 2.31.0 2.30.0 2.29.1 2.28.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 `CellValue`s will be called.

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

| ## Type Parameter ||
|---|---|
| **Name** | **Description** |
| `ChangeStreamRecordT` |   |

## Methods

### addToCell(String familyName, Value qualifier, Value timestamp, Value value)

    public abstract void addToCell(String familyName, Value qualifier, Value timestamp, Value value)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `familyName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `qualifier` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.Value` |
| `timestamp` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.Value` |
| `value` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.Value` |

### 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** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` |

### 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** ||
|---|---|
| **Name** | **Description** |
| `familyName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `qualifier` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` |
| `timestampRange` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.Range.TimestampRange` |

### deleteFamily(String familyName)

    public abstract void deleteFamily(String familyName)

Called to add a DeleteFamily mod.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `familyName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

### 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** ||
|---|---|
| **Name** | **Description** |
| `token` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `estimatedLowWatermark` | `https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ChangeStreamRecordT` |   |

### mergeToCell(String familyName, Value qualifier, Value timestamp, Value value)

    public abstract void mergeToCell(String familyName, Value qualifier, Value timestamp, Value value)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `familyName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `qualifier` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.Value` |
| `timestamp` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.Value` |
| `value` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.Value` |

### 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** ||
|---|---|
| **Name** | **Description** |
| `closeStream` | `com.google.bigtable.v2.ReadChangeStreamResponse.CloseStream` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `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** ||
|---|---|
| **Name** | **Description** |
| `heartbeat` | `com.google.bigtable.v2.ReadChangeStreamResponse.Heartbeat` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `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** ||
|---|---|
| **Name** | **Description** |
| `family` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `qualifier` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` |
| `timestampMicros` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

### 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** ||
|---|---|
| **Name** | **Description** |
| `rowKey` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` |
| `commitTimestamp` | `https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html` |
| `tieBreaker` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

### 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** ||
|---|---|
| **Name** | **Description** |
| `rowKey` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` |
| `sourceClusterId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `commitTimestamp` | `https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html` |
| `tieBreaker` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |