public final class Envelope extends Object
Envelope can be created for each message
schema using the defineSchema() builder, and once created can generate Struct objects representing CREATE,
READ, UPDATE, and DELETE messages that conform to that schema.| Modifier and Type | Class and Description |
|---|---|
static interface |
Envelope.Builder
A builder of an envelope schema.
|
static class |
Envelope.FieldName
The constants for the names of the fields in the message envelope.
|
static class |
Envelope.Operation
The constants for the values for the
operation field in the message envelope. |
| Modifier and Type | Field and Description |
|---|---|
static Set<String> |
ALL_FIELD_NAMES
The immutable set of all
Envelope.FieldNames. |
static boolean |
OPERATION_REQUIRED
Flag that specifies whether the
Envelope.FieldName.OPERATION field is required within the envelope. |
private org.apache.kafka.connect.data.Schema |
schema |
static String |
SCHEMA_NAME_SUFFIX
A suffix appended to each schema name representing Envelope
|
| Modifier | Constructor and Description |
|---|---|
private |
Envelope(org.apache.kafka.connect.data.Schema schema) |
| Modifier and Type | Method and Description |
|---|---|
org.apache.kafka.connect.data.Struct |
create(Object record,
org.apache.kafka.connect.data.Struct source,
Instant timestamp)
Generate a
create message with the given information. |
static Envelope.Builder |
defineSchema() |
org.apache.kafka.connect.data.Struct |
delete(Object before,
org.apache.kafka.connect.data.Struct source,
Instant timestamp)
Generate an
delete message with the given information. |
static Envelope |
fromSchema(org.apache.kafka.connect.data.Schema schema) |
static boolean |
isEnvelopeSchema(org.apache.kafka.connect.data.Schema schema) |
static boolean |
isEnvelopeSchema(String schemaName) |
static Envelope.Operation |
operationFor(org.apache.kafka.connect.source.SourceRecord record)
Obtain the operation for the given source record.
|
org.apache.kafka.connect.data.Struct |
read(Object record,
org.apache.kafka.connect.data.Struct source,
Instant timestamp)
Generate a
read message with the given information. |
org.apache.kafka.connect.data.Schema |
schema()
Get the
Schema describing the message envelopes and their content. |
static String |
schemaName(String type)
Converts an event type name into envelope schema name
|
org.apache.kafka.connect.data.Struct |
update(Object before,
org.apache.kafka.connect.data.Struct after,
org.apache.kafka.connect.data.Struct source,
Instant timestamp)
Generate an
update message with the given information. |
public static final boolean OPERATION_REQUIRED
Envelope.FieldName.OPERATION field is required within the envelope.public static final Set<String> ALL_FIELD_NAMES
Envelope.FieldNames.public static String SCHEMA_NAME_SUFFIX
private final org.apache.kafka.connect.data.Schema schema
public static Envelope.Builder defineSchema()
public static Envelope fromSchema(org.apache.kafka.connect.data.Schema schema)
public org.apache.kafka.connect.data.Schema schema()
Schema describing the message envelopes and their content.public org.apache.kafka.connect.data.Struct read(Object record, org.apache.kafka.connect.data.Struct source, Instant timestamp)
read message with the given information.record - the state of the record as read; may not be nullsource - the information about the source that was read; may be nulltimestamp - the timestamp for this message; may be nullpublic org.apache.kafka.connect.data.Struct create(Object record, org.apache.kafka.connect.data.Struct source, Instant timestamp)
create message with the given information.record - the state of the record after creation; may not be nullsource - the information about the source where the creation occurred; may be nulltimestamp - the timestamp for this message; may be nullpublic org.apache.kafka.connect.data.Struct update(Object before, org.apache.kafka.connect.data.Struct after, org.apache.kafka.connect.data.Struct source, Instant timestamp)
update message with the given information.before - the state of the record before the update; may be nullafter - the state of the record after the update; may not be nullsource - the information about the source where the update occurred; may be nulltimestamp - the timestamp for this message; may be nullpublic org.apache.kafka.connect.data.Struct delete(Object before, org.apache.kafka.connect.data.Struct source, Instant timestamp)
delete message with the given information.before - the state of the record before the delete; may be nullsource - the information about the source where the deletion occurred; may be nulltimestamp - the timestamp for this message; may be nullpublic static Envelope.Operation operationFor(org.apache.kafka.connect.source.SourceRecord record)
record - the source record; may not be nullpublic static String schemaName(String type)
type - public static boolean isEnvelopeSchema(String schemaName)
schemaName - public static boolean isEnvelopeSchema(org.apache.kafka.connect.data.Schema schema)
schema - Copyright © 2020 JBoss by Red Hat. All rights reserved.