Class Wal2JsonReplicationMessage
java.lang.Object
io.debezium.connector.postgresql.connection.wal2json.Wal2JsonReplicationMessage
- All Implemented Interfaces:
ReplicationMessage
Replication message representing message sent by the wal2json logical decoding plug-in.
- Author:
- Jiri Pechanec
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.debezium.connector.postgresql.connection.ReplicationMessage
ReplicationMessage.Column, ReplicationMessage.ColumnTypeMetadata, ReplicationMessage.ColumnValue<T>, ReplicationMessage.NoopMessage, ReplicationMessage.Operation -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Instantprivate final booleanprivate final booleanprivate static final org.slf4j.Loggerprivate final Documentprivate final Longprivate final TypeRegistry -
Constructor Summary
ConstructorsConstructorDescriptionWal2JsonReplicationMessage(Long txId, Instant commitTime, Document rawMessage, boolean hasMetadata, boolean lastEventForLsn, TypeRegistry typeRegistry) -
Method Summary
Modifier and TypeMethodDescriptiongetTable()getValue(String columnName, PostgresType type, String fullType, Value rawValue, PostgresStreamingChangeEventSource.PgConnectionSupplier connection, boolean includeUnknownDatatypes) Converts the value (string representation) coming from wal2json plugin to a Java value based on the type of the column from the message.booleanbooleanprivate Stringprivate List<ReplicationMessage.Column>transform(Document data, String nameField, String typeField, String valueField, String optionalsField) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.debezium.connector.postgresql.connection.ReplicationMessage
isTransactionalMessage, shouldSchemaBeSynchronized
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
txId
-
commitTime
-
rawMessage
-
hasMetadata
private final boolean hasMetadata -
lastEventForLsn
private final boolean lastEventForLsn -
typeRegistry
-
-
Constructor Details
-
Wal2JsonReplicationMessage
public Wal2JsonReplicationMessage(Long txId, Instant commitTime, Document rawMessage, boolean hasMetadata, boolean lastEventForLsn, TypeRegistry typeRegistry)
-
-
Method Details
-
getOperation
- Specified by:
getOperationin interfaceReplicationMessage- Returns:
- A data operation executed
-
getCommitTime
- Specified by:
getCommitTimein interfaceReplicationMessage- Returns:
- Transaction commit time for this change
-
getTransactionId
- Specified by:
getTransactionIdin interfaceReplicationMessage- Returns:
- An id of transaction to which this change belongs; will not be present for non-transactional logical decoding messages for instance
-
getTable
- Specified by:
getTablein interfaceReplicationMessage- Returns:
- Table changed
-
getOldTupleList
- Specified by:
getOldTupleListin interfaceReplicationMessage- Returns:
- Set of original values of table columns, null for INSERT
-
getNewTupleList
- Specified by:
getNewTupleListin interfaceReplicationMessage- Returns:
- Set of new values of table columns, null for DELETE
-
hasTypeMetadata
public boolean hasTypeMetadata()- Specified by:
hasTypeMetadatain interfaceReplicationMessage- Returns:
- true if type metadata are passed as a part of message
-
transform
-
parseType
-
getValue
public Object getValue(String columnName, PostgresType type, String fullType, Value rawValue, PostgresStreamingChangeEventSource.PgConnectionSupplier connection, boolean includeUnknownDatatypes) Converts the value (string representation) coming from wal2json plugin to a Java value based on the type of the column from the message. This value will be converted later on if necessary by thePostgresValueConverter#converter(Column, Field)instance to match whatever the Connect schema type expects. Note that the logic here is tightly coupled (i.e. dependent) on the wal2json plugin logic which writes the actual JSON messages.- Parameters:
a- supplier to get a connection to Postgres instance for array handling- Returns:
- the value; may be null
-
isLastEventForLsn
public boolean isLastEventForLsn()- Specified by:
isLastEventForLsnin interfaceReplicationMessage- Returns:
- true if this is the last message in the batch of messages with same LSN
-