Factory

@Serializable
@SerialName(value = "!Kafka")
data class Factory(val bootstrapServers: String, val topicName: String, var autoCreateTopic: Boolean = true, var replicationFactor: Int = 1, var pollDuration: Duration = Duration.ofSeconds(1), var topicConfig: Map<String, String> = emptyMap(), var propertiesMap: Map<String, String> = emptyMap(), var propertiesFile: Path? = null) : Log.Factory

Used to set configuration options for Kafka as an XTDB Transaction Log.

For more info on setting up the necessary infrastructure to be able to use Kafka as an XTDB Transaction Log, see the section on infrastructure within our Kafka Module Reference.

Example usage, as part of a node config:

Xtdb.openNode {
txLog = KafkaLogFactory(
bootstrapServers = "localhost:9092",
topicName = "xtdb_topic",
autoCreateTopic = true,
replicationFactor = 1,
pollDuration = Duration.ofSeconds(1)
),
...
}

Constructors

Link copied to clipboard
constructor(bootstrapServers: String, topicName: String, autoCreateTopic: Boolean = true, replicationFactor: Int = 1, pollDuration: Duration = Duration.ofSeconds(1), topicConfig: Map<String, String> = emptyMap(), propertiesMap: Map<String, String> = emptyMap(), propertiesFile: Path? = null)

Properties

Link copied to clipboard

Whether to automatically create the topic, if it does not already exist.

Link copied to clipboard

A comma-separated list of host:port pairs to use for establishing the initial connection to the Kafka cluster.

Link copied to clipboard

The maximum amount of time to block waiting for records to be returned by the Kafka consumer.

Link copied to clipboard

Path to a Java properties file containing Kafka connection properties, supplied directly to the Kafka client.

Link copied to clipboard

A map of Kafka connection properties, supplied directly to the Kafka client.

Link copied to clipboard

The replication factor of the transaction log topic (if it is automatically created by XTDB).

Link copied to clipboard

A map of topic configuration options to use when creating the transaction log topic (if it is automatically created by XTDB).

Link copied to clipboard

Name of the Kafka topic to use for the transaction log.

Functions

Link copied to clipboard
fun autoCreateTopic(autoCreateTopic: Boolean): Kafka.Factory
Link copied to clipboard
open override fun openLog(): Log
Link copied to clipboard
fun pollDuration(pollDuration: Duration): Kafka.Factory
Link copied to clipboard
fun propertiesFile(propertiesFile: Path): Kafka.Factory
Link copied to clipboard
Link copied to clipboard
fun replicationFactor(replicationFactor: Int): Kafka.Factory
Link copied to clipboard