@NotThreadSafe public class KafkaDatabaseHistory extends AbstractDatabaseHistory
DatabaseHistory implementation that records schema changes as normal SourceRecords on the specified topic,
and that recovers the history by establishing a Kafka Consumer re-processing all messages on that topic.| Modifier and Type | Field and Description |
|---|---|
static Collection<Field> |
ALL_FIELDS |
static Field |
BOOTSTRAP_SERVERS |
private static String |
CONSUMER_PREFIX |
private Configuration |
consumerConfig |
private Integer |
partition |
private int |
pollIntervalMs |
private org.apache.kafka.clients.producer.KafkaProducer<String,String> |
producer |
private static String |
PRODUCER_PREFIX |
private Configuration |
producerConfig |
private DocumentReader |
reader |
static Field |
RECOVERY_POLL_ATTEMPTS |
static Field |
RECOVERY_POLL_INTERVAL_MS |
private int |
recoveryAttempts |
static Field |
TOPIC |
private String |
topicName |
config, loggerCONFIGURATION_FIELD_PREFIX_STRING| Constructor and Description |
|---|
KafkaDatabaseHistory() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(Configuration config,
HistoryRecordComparator comparator)
Configure this instance.
|
protected void |
recoverRecords(Tables schema,
DdlParser ddlParser,
Consumer<HistoryRecord> records) |
void |
start()
Start the history.
|
void |
stop()
Stop recording history and release any resources acquired since
DatabaseHistory.configure(Configuration, HistoryRecordComparator). |
protected void |
storeRecord(HistoryRecord record) |
String |
toString() |
record, recoverpublic static final Field TOPIC
public static final Field BOOTSTRAP_SERVERS
public static final Field RECOVERY_POLL_INTERVAL_MS
public static final Field RECOVERY_POLL_ATTEMPTS
public static Collection<Field> ALL_FIELDS
private static final String CONSUMER_PREFIX
private static final String PRODUCER_PREFIX
private final DocumentReader reader
private final Integer partition
private String topicName
private Configuration consumerConfig
private Configuration producerConfig
private int recoveryAttempts
private int pollIntervalMs
public void configure(Configuration config, HistoryRecordComparator comparator)
DatabaseHistoryconfigure in interface DatabaseHistoryconfigure in class AbstractDatabaseHistoryconfig - the configuration for this history storecomparator - the function that should be used to compare history records during
recovery; may be null if the
default comparator is to be usedpublic void start()
DatabaseHistorystart in interface DatabaseHistorystart in class AbstractDatabaseHistoryprotected void storeRecord(HistoryRecord record)
storeRecord in class AbstractDatabaseHistoryprotected void recoverRecords(Tables schema, DdlParser ddlParser, Consumer<HistoryRecord> records)
recoverRecords in class AbstractDatabaseHistorypublic void stop()
DatabaseHistoryDatabaseHistory.configure(Configuration, HistoryRecordComparator).stop in interface DatabaseHistorystop in class AbstractDatabaseHistoryCopyright © 2016 JBoss by Red Hat. All rights reserved.