public class EventDispatcher<T extends DataCollectionId> extends Object
DatabaseSchema. But based on the applying whitelist/blacklist configuration,
events may be not be dispatched at all.
This router is also in charge of emitting heartbeat messages, exposing of metrics via JMX etc.
| Modifier and Type | Class and Description |
|---|---|
private class |
EventDispatcher.BufferingSnapshotChangeRecordReceiver |
static interface |
EventDispatcher.InconsistentSchemaHandler<T extends DataCollectionId>
Reaction to an incoming change event for which schema is not found
|
private class |
EventDispatcher.SchemaChangeEventReceiver |
static interface |
EventDispatcher.SnapshotReceiver
Change record receiver used during snapshotting.
|
private class |
EventDispatcher.StreamingChangeRecordReceiver |
private static final org.slf4j.Logger LOGGER
private final TopicSelector<T extends DataCollectionId> topicSelector
private final DatabaseSchema<T extends DataCollectionId> schema
private final HistorizedDatabaseSchema<T extends DataCollectionId> historizedSchema
private final ChangeEventQueue<DataChangeEvent> queue
private final DataCollectionFilters.DataCollectionFilter<T extends DataCollectionId> filter
private final ChangeEventCreator changeEventCreator
private final Heartbeat heartbeat
private DataChangeEventListener eventListener
private final boolean emitTombstonesOnDelete
private final EventDispatcher.InconsistentSchemaHandler<T extends DataCollectionId> inconsistentSchemaHandler
private final TransactionMonitor transactionMonitor
private final CommonConnectorConfig connectorConfig
private final org.apache.kafka.connect.data.Schema schemaChangeKeySchema
private final org.apache.kafka.connect.data.Schema schemaChangeValueSchema
private final TableChanges.TableChangesSerializer<List<org.apache.kafka.connect.data.Struct>> tableChangesSerializer
private final EventDispatcher.StreamingChangeRecordReceiver streamingReceiver
public EventDispatcher(CommonConnectorConfig connectorConfig, TopicSelector<T> topicSelector, DatabaseSchema<T> schema, ChangeEventQueue<DataChangeEvent> queue, DataCollectionFilters.DataCollectionFilter<T> filter, ChangeEventCreator changeEventCreator, EventMetadataProvider metadataProvider, SchemaNameAdjuster schemaNameAdjuster)
public EventDispatcher(CommonConnectorConfig connectorConfig, TopicSelector<T> topicSelector, DatabaseSchema<T> schema, ChangeEventQueue<DataChangeEvent> queue, DataCollectionFilters.DataCollectionFilter<T> filter, ChangeEventCreator changeEventCreator, EventMetadataProvider metadataProvider, Heartbeat heartbeat, SchemaNameAdjuster schemaNameAdjuster)
public EventDispatcher(CommonConnectorConfig connectorConfig, TopicSelector<T> topicSelector, DatabaseSchema<T> schema, ChangeEventQueue<DataChangeEvent> queue, DataCollectionFilters.DataCollectionFilter<T> filter, ChangeEventCreator changeEventCreator, EventDispatcher.InconsistentSchemaHandler<T> inconsistentSchemaHandler, EventMetadataProvider metadataProvider, Heartbeat customHeartbeat, SchemaNameAdjuster schemaNameAdjuster)
public void dispatchSnapshotEvent(T dataCollectionId, ChangeRecordEmitter changeRecordEmitter, EventDispatcher.SnapshotReceiver receiver) throws InterruptedException
InterruptedExceptionpublic EventDispatcher.SnapshotReceiver getSnapshotChangeEventReceiver()
public boolean dispatchDataChangeEvent(T dataCollectionId, ChangeRecordEmitter changeRecordEmitter) throws InterruptedException
DataChangeEvents. If the given data collection is included in the currently
captured set of collections, the given emitter will be invoked, so it can emit one or more events (in the common
case, one event will be emitted, but e.g. in case of PK updates, it may be a deletion and a creation event). The
receiving coordinator creates SourceRecords for all emitted events and passes them to this dispatcher's
ChangeEventCreator for converting them into data change events.true if an event was dispatched (i.e. sent to the message broker), false otherwise.InterruptedExceptionpublic void dispatchTransactionCommittedEvent(OffsetContext offset) throws InterruptedException
InterruptedExceptionpublic void dispatchTransactionStartedEvent(String transactionId, OffsetContext offset) throws InterruptedException
InterruptedExceptionpublic void dispatchConnectorEvent(ConnectorEvent event)
public Optional<DataCollectionSchema> errorOnMissingSchema(T dataCollectionId, ChangeRecordEmitter changeRecordEmitter)
public Optional<DataCollectionSchema> ignoreMissingSchema(T dataCollectionId, ChangeRecordEmitter changeRecordEmitter)
public void dispatchSchemaChangeEvent(T dataCollectionId, SchemaChangeEventEmitter schemaChangeEventEmitter) throws InterruptedException
InterruptedExceptionpublic void dispatchSchemaChangeEvent(List<T> dataCollectionIds, SchemaChangeEventEmitter schemaChangeEventEmitter) throws InterruptedException
InterruptedExceptionpublic void alwaysDispatchHeartbeatEvent(OffsetContext offset) throws InterruptedException
InterruptedExceptionpublic void dispatchHeartbeatEvent(OffsetContext offset) throws InterruptedException
InterruptedExceptionpublic boolean heartbeatsEnabled()
private void enqueueHeartbeat(org.apache.kafka.connect.source.SourceRecord record)
throws InterruptedException
InterruptedExceptionprivate void enqueueTransactionMessage(org.apache.kafka.connect.source.SourceRecord record)
throws InterruptedException
InterruptedExceptionprivate void enqueueSchemaChangeMessage(org.apache.kafka.connect.source.SourceRecord record)
throws InterruptedException
InterruptedExceptionpublic void setEventListener(DataChangeEventListener eventListener)
eventListener - Copyright © 2020 JBoss by Red Hat. All rights reserved.