All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.creekservice.api.kafka.extension.ClientsExtensionOptions Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2022-2023 Creek Contributors (https://github.com/creek-service)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.creekservice.api.kafka.extension;

import java.util.Optional;
import org.creekservice.api.kafka.extension.client.TopicClient;
import org.creekservice.api.kafka.extension.config.ClustersProperties;
import org.creekservice.api.kafka.extension.config.KafkaPropertyOverrides;
import org.creekservice.api.service.extension.CreekExtensionOptions;

/**
 * Client extension options.
 *
 * 

Used to customise how the client extension operates. */ public interface ClientsExtensionOptions extends CreekExtensionOptions { /** * @return the Kafka client properties */ ClustersProperties.Builder propertiesBuilder(); /** * @return explicit topic client to use */ Optional topicClient(); /** Build of client extension options. */ interface Builder { /** * Set an alternate provider of Kafka property overrides. * *

The default overrides provider loads them from environment variables. See {@link * org.creekservice.api.kafka.extension.config.SystemEnvPropertyOverrides} for more info. * *

It is intended that the provider should return, among other things, properties such as * the bootstrap servers, so that these can be configured per-environment. * *

Note: the properties returned by the provider will override any properties set * via {@link #withKafkaProperty}. * *

Note: Any custom override provider implementation may want to consider if it needs to * be compatible with the system tests, as the system tests set properties via environment * variables. * * @param overridesProvider a custom provider of Kafka overrides. * @return self */ Builder withKafkaPropertiesOverrides(KafkaPropertyOverrides overridesProvider); /** * Set a common Kafka client property. * *

This property will be set for all clusters unless overridden either via {@link * #withKafkaProperty(String, String, Object)} or via {@link #withKafkaPropertiesOverrides}. * * @param name the name of the property * @param value the value of the property * @return self */ Builder withKafkaProperty(String name, Object value); /** * Set a Kafka client property for a specific cluster. * *

Note: Any value set here can be overridden by the {@link #withKafkaPropertiesOverrides * overridesProvider}. * * @param cluster the name of the Kafka cluster this property should be scoped to. * @param name the name of the property * @param value the value of the property * @return self */ Builder withKafkaProperty(String cluster, String name, Object value); /** * Set an explicit topic client to use. * *

Intended for internal use only, to allow a mock client to be installed during testing. * * @param topicClient the client to use. * @return self. */ Builder withTopicClient(TopicClient topicClient); /** * Build the immutable options. * * @return the built options. */ ClientsExtensionOptions build(); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy