Java Code Examples for io.debezium.transforms.UnwrapFromEnvelope

Following code examples demonstrate how to use io.debezium.transforms.UnwrapFromEnvelopefrom debezium. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use io.debezium.transforms.UnwrapFromEnvelopeand various code implementation of this class.

	public io.debezium.config.Configuration configuration(CdcCommonProperties properties) {
		Map<String, String> configMap = properties.getConfig();
		return io.debezium.config.Configuration.from(configMap);

	public UnwrapFromEnvelope unwrapFromEnvelope(CdcCommonProperties properties) {
		UnwrapFromEnvelope unwrapFromEnvelope = new UnwrapFromEnvelope();
		Map<String, Object> config = unwrapFromEnvelope.config().defaultValues();
		config.put("drop.tombstones", properties.getFlattering().isDropTombstones());
		config.put("delete.handling.mode", properties.getFlattering().getDeleteHandlingMode().name());

		return unwrapFromEnvelope;

Debezium generates CDC ( Envelope) records that are struct of values containing values before and af

ter change. Sink connectors usually are not able to work with a complex structure so a user use this SMT to extract after value and send it down unwrapped in Envelope.

The functionality is similar to ExtractField SMT but has a special semantics for handling delete events; when delete event is emitted by database then Debezium emits two messages: a delete message and a tombstone message that serves as a signal to Kafka compaction process.

The SMT by default drops the tombstone message created by Debezium and converts the delete message into a tombstone message that can be dropped, too, if required. @param the subtype of ConnectRecord on which this transformation will operate @author Jiri Pechanec

Read More