Package oracle.kv.pubsub

# Interface StreamOperation

All Known Subinterfaces:
  `StreamOperation.DeleteEvent`, `StreamOperation.PutEvent`, `StreamOperation.TransactionEvent`

public interface StreamOperation
The operation (Put, Delete) that was delivered over the NoSQL stream.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `StreamOperation.DeleteEvent`
  Used to signal a Delete operation
  `static interface`
  `StreamOperation.PutEvent`
  Used to signal a Put operation
  `static interface`
  `StreamOperation.SequenceId`
  A SequenceId uniquely identifies a stream operation associated with a Publisher.
  `static interface`
  `StreamOperation.TransactionEvent`
  Used to signal a Transaction operation
  `static enum`
  `StreamOperation.Type`
  The type of the operation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `StreamOperation.DeleteEvent`
  `asDelete()`
  Converts this operation to a `StreamOperation.DeleteEvent`.
  `StreamOperation.PutEvent`
  `asPut()`
  Converts this operation to a `StreamOperation.PutEvent`.
  `default StreamOperation.TransactionEvent`
  `asTransaction()`
  Converts this operation to a `StreamOperation.TransactionEvent`.
  `Row`
  `getBeforeImage()`
  Returns the before image associated with the stream event represented by `StreamOperation`, or null if 1.
  `int`
  `getRepGroupId()`
  Returns the shard id associated with this operation.
  `StreamOperation.SequenceId`
  `getSequenceId()`
  Returns the unique sequence id associated with this operation.
  `StreamOperation.Type`
  `getType()`
  Returns the type of this operation.
  `boolean`
  `includeBeforeImage()`
  Returns true if the current stream is configured to include before image, false otherwise
  `boolean`
  `isBeforeImageEnabled()`
  Returns true if before image is enabled for the write operation in this event `StreamOperation` to the subscribed table in kvstore.
  `boolean`
  `isBeforeImageExpired()`
  Returns true if the before image is enabled for the write operation in this event `StreamOperation` but the before image has expired.

- ## Method Details

  - ### getSequenceId

    StreamOperation.SequenceId getSequenceId()
    Returns the unique sequence id associated with this operation.

  - ### getRepGroupId

    int getRepGroupId()
    Returns the shard id associated with this operation.

  - ### includeBeforeImage

    boolean includeBeforeImage()
    Returns true if the current stream is configured to include before image, false otherwise
    Returns:
      true if the current stream is configured to include before image, false otherwise

  - ### isBeforeImageEnabled

    boolean isBeforeImageEnabled()
    Returns true if before image is enabled for the write operation in this event `StreamOperation` to the subscribed table in kvstore. Returns false if otherwise.
    Returns:
      true if the before image is enabled, or false.

  - ### isBeforeImageExpired

    boolean isBeforeImageExpired()
    Returns true if the before image is enabled for the write operation in this event `StreamOperation` but the before image has expired. If the before image is disabled for the table or the subscription is not configured to include before image, it returns false. For insert operations to the subscribed table, for which the before image is null, this method returns false.
    Returns:
      true if the before image is enabled and expired, or false.

  - ### getBeforeImage

    Row getBeforeImage()
    Returns the before image associated with the stream event represented by `StreamOperation`, or null if 1. the stream is not configured to include before image, or 2. the before image is not enabled for the event, or 3. the before image is enabled while it does not exist for operations like insert.
    Returns:
      the before image associated with the stream event, or null.

  - ### getType

    StreamOperation.Type getType()
    Returns the type of this operation.
    Returns:
      the type of this operation

  - ### asPut

    StreamOperation.PutEvent asPut()
    Converts this operation to a `StreamOperation.PutEvent`.
    Returns:
      this operation as a Put
    Throws:
      `IllegalArgumentException` - if this operation is not a Put

  - ### asDelete

    StreamOperation.DeleteEvent asDelete()
    Converts this operation to a `StreamOperation.DeleteEvent`.
    Returns:
      this operation as a Delete
    Throws:
      `IllegalArgumentException` - if this operation is not a Delete

  - ### asTransaction

    default StreamOperation.TransactionEvent asTransaction()
    Converts this operation to a `StreamOperation.TransactionEvent`.
    Returns:
      this operation as a Transaction
    Throws:
      `IllegalArgumentException` - if this operation is not a Transaction