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.FieldName s. |
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 |
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,
Long timestamp)
Generate a
read 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,
Long timestamp)
Generate an
delete message with the given information. |
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,
Long 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. |
org.apache.kafka.connect.data.Struct |
update(Object before,
org.apache.kafka.connect.data.Struct after,
org.apache.kafka.connect.data.Struct source,
Long 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.FieldName
s.private final org.apache.kafka.connect.data.Schema schema
public static Envelope.Builder defineSchema()
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, Long 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, Long timestamp)
read
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, Long 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, Long 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 nullCopyright © 2018 JBoss by Red Hat. All rights reserved.