public class StrimziKafkaContainer extends org.testcontainers.containers.GenericContainer<StrimziKafkaContainer>
| Modifier and Type | Field and Description |
|---|---|
static int |
KAFKA_PORT
Default Kafka port
|
static String |
STARTER_SCRIPT
The file containing the startup script.
|
| Constructor and Description |
|---|
StrimziKafkaContainer()
Image name is specified lazily automatically in
doStart() method |
StrimziKafkaContainer(String dockerImageName)
Image name is specified by
dockerImageName |
| Modifier and Type | Method and Description |
|---|---|
String |
getBootstrapServers()
Get bootstrap servers of @code{StrimziKafkaContainer} instance
|
String |
getInternalZooKeeperConnect()
Get internal ZooKeeper connect string, which is running in the same container as Kafka
|
StrimziKafkaContainer |
waitForRunning()
Fluent method, which sets a waiting strategy to wait until the broker is ready.
|
StrimziKafkaContainer |
withBootstrapServers(Function<StrimziKafkaContainer,String> provider)
Fluent method, assign provider for overriding bootstrap servers string
|
StrimziKafkaContainer |
withBrokerId(int brokerId)
Fluent method, which sets @code{brokerId}.
|
StrimziKafkaContainer |
withExternalZookeeperConnect(String externalZookeeperConnect)
Fluent method, which sets @code{externalZookeeperConnect}.
|
StrimziKafkaContainer |
withKafkaConfigurationMap(Map<String,String> kafkaConfigurationMap)
Fluent method, which sets @code{kafkaConfigurationMap}.
|
StrimziKafkaContainer |
withKafkaVersion(String kafkaVersion)
Fluent method, which sets @code{kafkaVersion}.
|
StrimziKafkaContainer |
withKraft()
Fluent method, which sets @code{useKraft}.
|
StrimziKafkaContainer |
withPort(int fixedPort)
Fluent method, which sets fixed exposed port.
|
StrimziKafkaContainer |
withServerProperties(org.testcontainers.utility.MountableFile serverPropertiesFile)
Fluent method, copy server properties file to the container
|
addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addLink, apply, copyFileFromContainer, dependsOn, dependsOn, dependsOn, equals, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPortNumbers, getLogConsumers, getNetwork, getNetworkAliases, getNetworkMode, getPortBindings, getShmSize, getStartupAttempts, getStartupCheckStrategy, getTestHostIpAddress, getTmpFsMapping, getVolumesFroms, getWorkingDirectory, hashCode, isPrivilegedMode, isShouldBeReused, setBinds, setCommand, setCommand, setCommandParts, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, stop, toString, waitingFor, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCreateContainerCmdModifier, withEnv, withEnv, withExposedPorts, withExtraHost, withFileSystemBind, withImagePullPolicy, withLabel, withLabels, withLogConsumer, withMinimumRunningDuration, withNetwork, withNetworkAliases, withNetworkMode, withPrivilegedMode, withReuse, withSharedMemorySize, withStartupAttempts, withStartupCheckStrategy, withStartupTimeout, withTmpFs, withVolumesFrom, withWorkingDirectoryaddFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBindcopyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunningpublic static final String STARTER_SCRIPT
public static final int KAFKA_PORT
public StrimziKafkaContainer()
doStart() methodpublic StrimziKafkaContainer(String dockerImageName)
dockerImageNamedockerImageName - specific docker image name provided by constructor parameterpublic StrimziKafkaContainer waitForRunning()
This method waits for a log message in the broker log.
You can customize the strategy using GenericContainer.waitingFor(WaitStrategy).
public String getInternalZooKeeperConnect()
public String getBootstrapServers()
public StrimziKafkaContainer withKafkaConfigurationMap(Map<String,String> kafkaConfigurationMap)
kafkaConfigurationMap - kafka configurationpublic StrimziKafkaContainer withExternalZookeeperConnect(String externalZookeeperConnect)
If the broker was created using Kraft, this method throws an IllegalArgumentException.
externalZookeeperConnect - connect stringpublic StrimziKafkaContainer withBrokerId(int brokerId)
brokerId - broker idpublic StrimziKafkaContainer withKafkaVersion(String kafkaVersion)
kafkaVersion - kafka versionpublic StrimziKafkaContainer withKraft()
Flag to signal if we deploy Kafka with ZooKeeper or not.
public StrimziKafkaContainer withPort(int fixedPort)
fixedPort - fixed port to exposepublic StrimziKafkaContainer withServerProperties(org.testcontainers.utility.MountableFile serverPropertiesFile)
serverPropertiesFile - the mountable config filepublic StrimziKafkaContainer withBootstrapServers(Function<StrimziKafkaContainer,String> provider)
provider - provider function for bootstrapServers stringCopyright © 2022. All rights reserved.