Package io.debezium.converters
Class CloudEventsMaker
- java.lang.Object
-
- io.debezium.converters.CloudEventsMaker
-
- Direct Known Subclasses:
CloudEventsMaker.MongodbCloudEventsMaker,CloudEventsMaker.MysqlCloudEventsMaker,CloudEventsMaker.PostgresCloudEventsMaker,CloudEventsMaker.SqlserverCloudEventsMaker
public abstract class CloudEventsMaker extends Object
An abstract class that builds CloudEvents attributes using fields of change records provided byRecordParser. Callerscreate(RecordParser, SerializerType, String)create} a concrete CloudEventsMaker for a specific connector type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCloudEventsMaker.FieldNameThe constants for the names of CloudEvents attributes.static classCloudEventsMaker.MongodbCloudEventsMakerCloudEvents maker for records produced by MongoDB connector.static classCloudEventsMaker.MysqlCloudEventsMakerCloudEvents maker for records produced by MySQL connector.static classCloudEventsMaker.PostgresCloudEventsMakerCloudEvents maker for records produced by PostgreSQL connector.static classCloudEventsMaker.SqlserverCloudEventsMakerCloudEvents maker for records produced by SQL Server connector.
-
Field Summary
Fields Modifier and Type Field Description private org.apache.kafka.connect.data.SchemaceDataAttributeSchemastatic StringCLOUDEVENTS_SPECVERSION(package private) static Map<SerializerType,String>CONTENT_TYPE_NAME_MAPprivate SerializerTypedataContentTypeprivate StringdataSchemaUriBaseprotected RecordParserrecordParserprivate static StringSCHEMA_URL_PATH
-
Constructor Summary
Constructors Modifier Constructor Description privateCloudEventsMaker(RecordParser parser, SerializerType contentType, String dataSchemaUriBase)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.apache.kafka.connect.data.StructceDataAttribute()Construct the value of the data attribute of CloudEvents.org.apache.kafka.connect.data.SchemaceDataAttributeSchema()Construct the schema of the data attribute of CloudEvents.StringceDatacontenttype()Get the data content type of CloudEvents envelope.StringceDataschemaUri(String schemaId)Get the data schema url of CloudEvents envelope.StringceEnvelopeSchemaName()Construct the name of the schema of CloudEvents envelope.abstract StringceId()Construct the id of CloudEvents envelope.StringceSource(String logicalName)Construct the source field of CloudEvents envelope, e.g.StringceSpecversion()Get the version of CloudEvents specification.StringceTime()Get the timestamp of CloudEvents envelope using the format defined in RFC 3339.StringceType()Construct the type field of CloudEvents envelope.static CloudEventsMakercreate(RecordParser parser, SerializerType contentType)Create a concrete CloudEvents maker using the outputs of a record parser.static CloudEventsMakercreate(RecordParser parser, SerializerType contentType, String dataSchemaUriBase)Create a concrete CloudEvents maker using the outputs of a record parser.
-
-
-
Field Detail
-
SCHEMA_URL_PATH
private static final String SCHEMA_URL_PATH
- See Also:
- Constant Field Values
-
CLOUDEVENTS_SPECVERSION
public static final String CLOUDEVENTS_SPECVERSION
- See Also:
- Constant Field Values
-
dataContentType
private final SerializerType dataContentType
-
dataSchemaUriBase
private final String dataSchemaUriBase
-
ceDataAttributeSchema
private final org.apache.kafka.connect.data.Schema ceDataAttributeSchema
-
recordParser
protected final RecordParser recordParser
-
CONTENT_TYPE_NAME_MAP
static final Map<SerializerType,String> CONTENT_TYPE_NAME_MAP
-
-
Constructor Detail
-
CloudEventsMaker
private CloudEventsMaker(RecordParser parser, SerializerType contentType, String dataSchemaUriBase)
-
-
Method Detail
-
create
public static CloudEventsMaker create(RecordParser parser, SerializerType contentType, String dataSchemaUriBase)
Create a concrete CloudEvents maker using the outputs of a record parser. Also need to specify the data content type (that is the serialization format of the data attribute).- Parameters:
parser- the parser of a change recordcontentType- the data content type of CloudEventsdataSchemaUriBase- the URI of the schema in case of Avro; may be null- Returns:
- a concrete CloudEvents maker
-
create
public static CloudEventsMaker create(RecordParser parser, SerializerType contentType)
Create a concrete CloudEvents maker using the outputs of a record parser. Also need to specify the data content type (that is the serialization format of the data attribute) and the url of data schema registry when using Avro as the data content type.- Parameters:
parser- the parser of a change recordcontentType- the data content type of CloudEvents- Returns:
- a concrete CloudEvents maker
-
ceId
public abstract String ceId()
Construct the id of CloudEvents envelope.- Returns:
- the id of CloudEvents envelope
-
ceSource
public String ceSource(String logicalName)
Construct the source field of CloudEvents envelope, e.g. "/debezium/postgres/dbserver1".- Returns:
- the source field of CloudEvents envelope
-
ceSpecversion
public String ceSpecversion()
Get the version of CloudEvents specification.- Returns:
- the version of CloudEvents specification
-
ceType
public String ceType()
Construct the type field of CloudEvents envelope.- Returns:
- the type field of CloudEvents envelope
-
ceDatacontenttype
public String ceDatacontenttype()
Get the data content type of CloudEvents envelope.- Returns:
- the data content type of CloudEvents envelope
-
ceDataschemaUri
public String ceDataschemaUri(String schemaId)
Get the data schema url of CloudEvents envelope.- Returns:
- the data schema url of CloudEvents envelope
-
ceTime
public String ceTime()
Get the timestamp of CloudEvents envelope using the format defined in RFC 3339.- Returns:
- the timestamp of CloudEvents envelope
-
ceDataAttributeSchema
public org.apache.kafka.connect.data.Schema ceDataAttributeSchema()
Construct the schema of the data attribute of CloudEvents.- Returns:
- the schema of the data attribute of CloudEvents
-
ceDataAttribute
public org.apache.kafka.connect.data.Struct ceDataAttribute()
Construct the value of the data attribute of CloudEvents.- Returns:
- the value of the data attribute of CloudEvents
-
ceEnvelopeSchemaName
public String ceEnvelopeSchemaName()
Construct the name of the schema of CloudEvents envelope.- Returns:
- the name of the schema of CloudEvents envelope
-
-