com.alibaba.ververica.cdc.debezium.internal.DebeziumState Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.ververica.cdc.debezium.internal;
import org.apache.flink.annotation.Internal;
import java.util.Map;
/**
* The state that the Flink Debezium Consumer holds for each instance.
*
* This class describes the most basic state that Debezium used for recovering based
* on Kafka Connect mechanism. It includes a sourcePartition and sourceOffset.
*
*
* The sourcePartition represents a single input sourcePartition that the record came from (e.g. a filename, table
* name, or topic-partition). The sourceOffset represents a position in that sourcePartition which can be used
* to resume consumption of data.
*
*
* These values can have arbitrary structure and should be represented using
* org.apache.kafka.connect.data objects (or primitive values). For example, a database connector
* might specify the sourcePartition as a record containing { "db": "database_name", "table":
* "table_name"} and the sourceOffset as a Long containing the timestamp of the row.
*/
@Internal
public class DebeziumState {
public Map sourcePartition;
public Map sourceOffset;
public void setSourcePartition(Map sourcePartition) {
this.sourcePartition = sourcePartition;
}
public void setSourceOffset(Map sourceOffset) {
this.sourceOffset = sourceOffset;
}
@Override
public String toString() {
return "DebeziumConsumerState{" +
"sourcePartition=" + sourcePartition +
", sourceOffset=" + sourceOffset +
'}';
}
}