Skip to content

Add or remove withPort, withServerProperties and withBootstrapServers methods in StrimziKafkaContainer #171

@see-quick

Description

@see-quick

As we have removed StrimziKafkaContainer from the public API, there are still methods which are not in StrimziKafkaCluster. For instance:

/**
     * Fluent method, which sets fixed exposed port.
     *
     * @param fixedPort fixed port to expose
     * @return StrimziKafkaContainer instance
     */
    public StrimziKafkaContainer withPort(final int fixedPort) {
        if (fixedPort <= 0) {
            throw new IllegalArgumentException("The fixed Kafka port must be greater than 0");
        }
        addFixedExposedPort(fixedPort, KAFKA_PORT);
        return self();
    }

    /**
     * Fluent method, copy server properties file to the container
     *
     * @param serverPropertiesFile the mountable config file
     * @return StrimziKafkaContainer instance
     */
    public StrimziKafkaContainer withServerProperties(final MountableFile serverPropertiesFile) {
        /*
         * Save a reference to the file and delay copying to the container until the container
         * is starting.
         */
        this.serverPropertiesFile = serverPropertiesFile;
        return self();
    }
a
    /**
     * Fluent method, assign provider for overriding bootstrap servers string
     *
     * @param provider provider function for bootstrapServers string
     * @return StrimziKafkaContainer instance
     */
    public StrimziKafkaContainer withBootstrapServers(final Function<StrimziKafkaContainer, String> provider) {
        this.bootstrapServersProvider = provider;
        return self();
    }

We can either remove them entirely or keep them in StrimziKafkaCluster for backward compatibility. The latter requires additional logic because multiple nodes can be deployed. Also, another possible way would be to expose List<StrimziKafkaContainer> to a user. Currently, we only expose a List of KafkaContainer (which contains just two methods).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions