Class AbstractMessageDecoder
- java.lang.Object
-
- io.debezium.connector.postgresql.connection.AbstractMessageDecoder
-
- All Implemented Interfaces:
MessageDecoder
- Direct Known Subclasses:
NonStreamingWal2JsonMessageDecoder,PgOutputMessageDecoder,PgProtoMessageDecoder,StreamingWal2JsonMessageDecoder
public abstract class AbstractMessageDecoder extends Object implements MessageDecoder
Abstract implementation ofMessageDecoderthat all decoders should inherit from.- Author:
- Chris Cranford
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.LoggerLOGGER
-
Constructor Summary
Constructors Constructor Description AbstractMessageDecoder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this decoder, freeing and/or closing all resources it may potentially hold.voidprocessMessage(ByteBuffer buffer, ReplicationStream.ReplicationMessageProcessor processor, TypeRegistry typeRegistry)Process a message upon arrival from logical decoderprotected abstract voidprocessNotEmptyMessage(ByteBuffer buffer, ReplicationStream.ReplicationMessageProcessor processor, TypeRegistry typeRegistry)booleanshouldMessageBeSkipped(ByteBuffer buffer, Lsn lastReceivedLsn, Lsn startLsn, WalPositionLocator walPosition)A callback into the decoder allowing it to decide whether the supplied message should be processed by the decoder or whether it can be skipped.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.debezium.connector.postgresql.connection.MessageDecoder
optionsWithMetadata, optionsWithoutMetadata, setContainsMetadata
-
-
-
-
Method Detail
-
processMessage
public void processMessage(ByteBuffer buffer, ReplicationStream.ReplicationMessageProcessor processor, TypeRegistry typeRegistry) throws SQLException, InterruptedException
Description copied from interface:MessageDecoderProcess a message upon arrival from logical decoder- Specified by:
processMessagein interfaceMessageDecoder- Parameters:
buffer- - binary representation of replication messageprocessor- - message processing on arrivaltypeRegistry- - registry with known types- Throws:
SQLExceptionInterruptedException
-
processNotEmptyMessage
protected abstract void processNotEmptyMessage(ByteBuffer buffer, ReplicationStream.ReplicationMessageProcessor processor, TypeRegistry typeRegistry) throws SQLException, InterruptedException
- Throws:
SQLExceptionInterruptedException
-
shouldMessageBeSkipped
public boolean shouldMessageBeSkipped(ByteBuffer buffer, Lsn lastReceivedLsn, Lsn startLsn, WalPositionLocator walPosition)
Description copied from interface:MessageDecoderA callback into the decoder allowing it to decide whether the supplied message should be processed by the decoder or whether it can be skipped.- Specified by:
shouldMessageBeSkippedin interfaceMessageDecoder- Parameters:
buffer- the replication stream bufferlastReceivedLsn- the last LSN reported by the replication streamstartLsn- the starting LSN reported by the streaming producerwalPosition- wal position from which the streaming should resume- Returns:
trueif the incoming message should be skipped,falseotherwise
-
close
public void close()
Description copied from interface:MessageDecoderCloses this decoder, freeing and/or closing all resources it may potentially hold.- Specified by:
closein interfaceMessageDecoder
-
-