### Install Kafka Plugin from Configuration File Source: https://flaxoos.github.io/extra-ktor-plugins/ktor-server-kafka Install the Kafka plugin using an application configuration file for simplified setup. This approach reads Kafka configurations from `ktor.kafka` by default, allowing for externalized settings. You can also specify a custom configuration path. ```kotlin install(KafkaFromFileConfig.Kafka) { consumerConfig { consumerRecordHandler("my-topic") { record -> myService.save(record) } } registerSchemas { MyRecord::class at named("my-topic") // <-- Will register schema upon startup } } ``` ```kotlin install(KafkaFromFileConfig.Kafka("ktor.my.kafka")) { ... } ``` -------------------------------- ### Example Kafka Configuration File Source: https://flaxoos.github.io/extra-ktor-plugins/ktor-server-kafka An example of how to structure the Kafka configuration within the `ktor.kafka` section of your application configuration file. This includes settings for schema registry, common client properties, admin, consumer, producer, and topic definitions. ```hocon ktor { kafka { schema.registry.url = ["SCHEMA_REGISTRY_URL"] common { "bootstrap.servers" = ["BOOTSTRAP_SERVERS"] # Additional configuration } admin { ##Additional configuration } consumer { "group.id" = "my-group-id" # Additional configuration } producer { "client.id" = "my-client-id" # Additional configuration } topics = [ { name = my-topic partitions = 1 replicas = 1 configs { "message.timestamp.type" = CreateTime # Additional configuration } } ] } } ``` -------------------------------- ### Kafka Plugin Installation Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-file-config Installs the Kafka plugin with a configuration block. This function allows for programmatic configuration of Kafka settings. ```APIDOC ## kafka ### Description Installs the Kafka plugin with the given KafkaFileConfig block. ### Signature `fun Application.kafka(configurationPath: String = DEFAULT_CONFIG_PATH, config: KafkaFileConfig.() -> Unit)` ### Parameters - `configurationPath` (String, optional, default: `DEFAULT_CONFIG_PATH`): The path to the configuration file. - `config` (KafkaFileConfig.() -> Unit): A lambda function to configure Kafka settings. ``` -------------------------------- ### Install and Configure Kafka Plugin Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-file-config/-kafka Use this snippet to install the Kafka plugin and configure the consumer. Specify the topic and the handler for incoming records. ```kotlin install(Kafka) { consumerConfig { consumerRecordHandler("my-topic) { record -> myService.save(record) ) } } ``` -------------------------------- ### Install and Configure Kafka Plugin Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-kafka Use this snippet to install and configure the Kafka plugin within your Ktor application. It demonstrates setting up schema registry URLs, defining topics with partitions and replicas, configuring common Kafka properties, and initializing admin, producer, and consumer clients. It also shows how to define a consumer record handler for a specific topic. ```kotlin install(Kafka) { schemaRegistryUrl = listOf(super.schemaRegistryUrl) topic(it) { partitions = 1 replicas = 1 configs { messageTimestampType = CreateTime } } common { bootstrapServers = listOf("my-kafka") } admin { } // will create an admin producer { clientId = "my-client-id" } // will create a producer consumer { groupId = "my-group-id" } // will create a consumer consumerConfig { consumerRecordHandler("my-topic) { record -> myService.save(record) ) } } ``` -------------------------------- ### Kafka Plugin Installation Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-file-config/kafka Installs the Kafka plugin with the given KafkaFileConfig block. You can specify a custom configuration path or use the default. ```APIDOC ## kafka [jvm]\nfun Application.kafka( configurationPath: String = DEFAULT_CONFIG_PATH, config: KafkaFileConfig.() -> Unit) ### Description Installs the Kafka plugin with the given KafkaFileConfig block. ### Parameters - **configurationPath** (String) - Optional - The path to the Kafka configuration file. Defaults to `DEFAULT_CONFIG_PATH`. - **config** (KafkaFileConfig.() -> Unit) - A lambda function to configure Kafka settings. ``` -------------------------------- ### Kafka Plugin Installation Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-file-config/-kafka Installs and configures the Kafka plugin for a Ktor application. The configuration is loaded from the application's config file. ```APIDOC ## Kafka Plugin ### Description Plugin for setting up a kafka client, configured in application config file. ### Usage ```kotlin install(Kafka) { consumerConfig { consumerRecordHandler("my-topic) { record -> myService.save(record) ) } } ``` ### Parameters * `configurationPath`: The path to the configuration in the application configuration file. * `config`: Configuration block for the plugin, see [KafkaConsumerConfig]. ``` -------------------------------- ### installKafka Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/install-kafka Installs the Kafka plugin with the given KafkaConfig block. This function is an extension function on the Ktor Application. ```APIDOC ## installKafka ### Description Installs the Kafka plugin with the given KafkaConfig block. ### Signature ```kotlin fun Application.installKafka(config: KafkaConfig.() -> Unit) ``` ### Parameters * `config` - A lambda function that allows configuring Kafka settings. ``` -------------------------------- ### Kafka Plugin Configuration Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-kafka This snippet demonstrates how to install and configure the Kafka plugin in a Ktor application. It shows setting up schema registry URLs, defining topics with partitions and replicas, configuring common Kafka settings, and initializing admin clients, producers, and consumers. ```APIDOC ## Kafka Plugin ### Description Plugin for setting up a kafka client. ### Usage ```kotlin install(Kafka) { schemaRegistryUrl = listOf(super.schemaRegistryUrl) topic(it) { partitions = 1 replicas = 1 configs { messageTimestampType = CreateTime } } common { bootstrapServers = listOf("my-kafka") } admin { } // will create an admin producer { clientId = "my-client-id" } // will create a producer consumer { groupId = "my-group-id" } // will create a consumer consumerConfig { consumerRecordHandler("my-topic) { record -> myService.save(record) ) } } ``` ### Configuration Options - `schemaRegistryUrl`: List of URLs for the schema registry. - `topic`: Defines a Kafka topic with its configurations (partitions, replicas, topic-specific configs). - `common`: Sets common configurations for Kafka clients (e.g., `bootstrapServers`). - `admin`: Initializes an admin client. - `producer`: Initializes a producer client with a specified `clientId`. - `consumer`: Initializes a consumer client with a specified `groupId`. - `consumerConfig`: Configures consumer behavior, including `consumerRecordHandler` for processing records from a topic. ``` -------------------------------- ### Install and Configure Task Scheduling Plugin Source: https://flaxoos.github.io/extra-ktor-plugins/ktor-server-task-scheduling Install the TaskScheduling plugin in your Ktor application and define one or more task managers. The 'redis' block sets the default manager. ```kotlin install(TaskScheduling){ redis{ //<-- this will be the default manager ... } jdbc("my jdbc manager"){ ... } } ``` -------------------------------- ### Kafka Client Setup Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-file-config Provides a property to access the Kafka client configuration, intended for use within the application's configuration file. ```APIDOC ## Kafka ### Description Represents the Kafka client configuration, typically set up in the application's configuration file. ### Type `val Kafka: ApplicationPlugin` ### Usage This property is used to define and apply Kafka client settings within the Ktor application's configuration. ``` -------------------------------- ### Install and Configure RateLimiting Plugin Source: https://flaxoos.github.io/extra-ktor-plugins/ktor-server-rate-limiting Apply the RateLimiting plugin within your Ktor routing configuration. Customize rate limiting strategies, whitelisting, blacklisting, and the response for exceeded limits. ```kotlin routing { route("limited-route") { install(RateLimiting) { rateLimiter { type = TokenBucket::class rate = 1.seconds capacity = 100 } whiteListedHosts = setOf("trusted-host.com") blackListedAgents = setOf("malicious-agent") rateLimitExceededHandler = { rateLimiterResponse -> ... respond(HttpStatusCode.TooManyRequests, rateLimiterResponse.message) } } get { call.respondText("Welcome to our limited route!") } } } ``` -------------------------------- ### Access Kafka Clients in Ktor Application Source: https://flaxoos.github.io/extra-ktor-plugins/ktor-server-kafka Retrieve initialized Kafka Admin Client, Producer, and Consumer instances directly from the Ktor application object after the Kafka plugin has been installed and configured. ```kotlin val adminClient = application.kafkaAdminClient val producer = application.kafkaProducer val consumer = application.kafkaConsumer ``` -------------------------------- ### preallocate Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-topic-properties-builder/preallocate Configures whether to preallocate partitions for the topic. When set to true, Kafka will create all partitions for the topic when it is first created. This can be useful for ensuring that partitions are evenly distributed across brokers from the start. ```APIDOC ## preallocate ### Description Configures whether to preallocate partitions for the topic. When set to true, Kafka will create all partitions for the topic when it is first created. This can be useful for ensuring that partitions are evenly distributed across brokers from the start. ### Property - `preallocate`: Boolean? - Determines if topic preallocation is enabled. ``` -------------------------------- ### RateLimiting Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter/-rate-limiting The RateLimiting plugin is a RouteScopedPlugin that can be applied to routes to provide specific rate limiting configurations. Refer to RateLimitingConfiguration for detailed setup. ```APIDOC ## RateLimiting ### Description Applies route-scoped rate limiting. ### Type `RouteScopedPlugin` ### Usage Apply this plugin to a specific route to configure its rate limiting behavior. Detailed configuration options are available in `RateLimitingConfiguration`. ``` -------------------------------- ### Configure Global and Named Circuit Breakers Source: https://flaxoos.github.io/extra-ktor-plugins/ktor-client-circuit-breaker Install the CircuitBreaking plugin and configure global defaults along with specific named circuit breakers for different services. ```kotlin HttpClient { install(CircuitBreaking) { config.global { failureThreshold = 10 halfOpenFailureThreshold = 5 resetInterval = 100.milliseconds } config.register("strict".toCircuitBreakerName()) { failureThreshold = 2 halfOpenFailureThreshold = 1 resetInterval = 1.seconds } } } ``` -------------------------------- ### Add Ktor Server Rate Limiting Plugin Source: https://flaxoos.github.io/extra-ktor-plugins/guide/installation Add the Ktor server rate limiting plugin to your project's dependencies. Use the correct `$ktor_plugins_version` for your setup. ```gradle implementation("io.github.flaxoos:ktor-server-rate-limiting:$ktor_plugins_version") ``` -------------------------------- ### init Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers.lock.redis/-redis-lock-manager Initializes the RedisLockManager with a list of tasks. ```APIDOC ## init ### Description Initializes the RedisLockManager, potentially preparing it for operation with the given list of tasks. ### Method `suspend fun init(tasks: List)` ### Parameters - **tasks** (List) - The list of tasks to initialize with. ``` -------------------------------- ### connectionAcquisitionTimeoutMs Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers.lock.redis/-redis-task-lock-manager-configuration/connection-acquisition-timeout-ms The timeout in milliseconds for trying to get a connection from the Redis pool. ```APIDOC ## connectionAcquisitionTimeoutMs ### Description The timeout for trying to get a connection to from the pool. ### Property - **connectionAcquisitionTimeoutMs** (Long) - The timeout in milliseconds. ``` -------------------------------- ### init Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers.lock.database/-database-task-lock-manager/init Initializes the TaskManager with the given tasks it manages. ```APIDOC ## init ### Description Initialize the TaskManager with the given tasks it manages ### Method `suspend override fun init( tasks: List )` ### Parameters #### Path Parameters - **tasks** (List) - Required - The list of tasks to initialize the manager with. ``` -------------------------------- ### clock Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter/-rate-limiter/clock Provides a time provider in milliseconds. This can be used to get the current time for rate limiting calculations. ```APIDOC ## clock ### Description Provides a time provider in milliseconds. ### Signature `open val clock: () -> Long` ``` -------------------------------- ### CircuitBreaking Client Plugin Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.client.plugins.circuitbreaker/-circuit-breaking The CircuitBreaking plugin is a client plugin for Ktor that requires a CircuitBreakerConfig to be configured. It can be installed in the Ktor client. ```APIDOC ## CircuitBreaking ### Description The `CircuitBreaking` plugin is a client plugin for Ktor that allows you to implement the circuit breaker pattern. It requires a `CircuitBreakerConfig` to be configured upon installation. ### Usage To use the `CircuitBreakerConfig`, you would typically install it in your Ktor client configuration: ```kotlin client.config { install(CircuitBreaking) { // Configure your circuit breaker settings here } } ``` ### Type `val CircuitBreaking: ClientPlugin` ``` -------------------------------- ### init Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers.lock/-task-lock-manager Initializes the TaskManager with a list of tasks it will manage. This method should be called before any other operations. ```APIDOC ## init ### Description Initialize the TaskManager with the given tasks it manages. ### Signature abstract suspend fun init(tasks: List) ### Parameters - **tasks** (List) - A list of tasks to be managed by this TaskManager. ``` -------------------------------- ### acquireLockKey Function Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers.lock.database/-database-task-lock-manager/acquire-lock-key Acquires a lock key to get permission to execute a task. Returns a DB_TASK_LOCK_KEY if successful, otherwise null. ```APIDOC ## acquireLockKey ### Description Get permission to execute the task. ### Signature suspend override fun acquireLockKey( task: Task, executionTime: DateTime, concurrencyIndex: Int): DB_TASK_LOCK_KEY? ### Parameters #### Path Parameters - **task** (Task) - The task for which to acquire the lock. - **executionTime** (DateTime) - The scheduled execution time of the task. - **concurrencyIndex** (Int) - The concurrency index for the task. #### Return Value - **DB_TASK_LOCK_KEY?** - A lock key if acquired successfully, otherwise null. ``` -------------------------------- ### SchemaRegistrationBuilder.using Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-schema-registration-builder/using Configures the `HttpClient` to be used for schema registration. You can provide your own `HttpClient` instance, or if none is provided, a default `HttpClient` using CIO will be configured. This client will be set up with JSON serialization and the `schemaRegistrationTimeoutMs` from the `AbstractKafkaConfig`. ```APIDOC ## using [jvm]\nfun using(provider: () -> HttpClient) Optionally provide a client to register schemas, by default, CIO would be used. In any case, the following it would be configured with serialization json and the configured AbstractKafkaConfig.schemaRegistrationTimeoutMs ``` -------------------------------- ### xtest(name: String) Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling/-task-scheduling-plugin-test Initializes a test configuration for the Task Scheduling plugin with a given name. Returns a builder for further configuration. ```APIDOC ## xtest(name: String) ### Description Initializes a test configuration for the Task Scheduling plugin with a given name. Returns a builder for further configuration. ### Signature open fun xtest(name: String): RootTestWithConfigBuilder ``` -------------------------------- ### acquireLockKey Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers.lock/-task-lock-manager Acquires a lock key for a given task, execution time, and concurrency index. This method is used to get permission to execute a task. ```APIDOC ## acquireLockKey ### Description Get permission to execute the task. ### Signature abstract suspend fun acquireLockKey(task: Task, executionTime: DateTime, concurrencyIndex: Int): TASK_LOCK? ### Parameters - **task** (Task) - The task to acquire a lock for. - **executionTime** (DateTime) - The scheduled execution time of the task. - **concurrencyIndex** (Int) - The concurrency index for the task. ### Returns - TASK_LOCK? - A TaskLock object if the lock is acquired, otherwise null. ``` -------------------------------- ### TaskManager Initialization Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers/-task-manager/init Initializes the TaskManager with a list of tasks it will manage. ```APIDOC ## init ### Description Initialize the TaskManager with the given tasks it manages ### Method `abstract suspend fun` ### Parameters #### Path Parameters - **tasks** (List) - Required - The list of tasks to be managed by the TaskManager. ``` -------------------------------- ### Get All MessageTimestampType Values Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-message-timestamp-type/values The `values()` function returns an array containing all constants of the `MessageTimestampType` enum. This can be used for iteration or to access specific enum values. ```APIDOC ## values() ### Description Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants. ### Signature ```kotlin fun values(): Array ``` ``` -------------------------------- ### TokenBucket Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter.implementations/-token-bucket Initializes a new instance of the TokenBucket rate limiter. ```APIDOC ## TokenBucket Constructor ### Description Initializes a new instance of the TokenBucket rate limiter with specified parameters. ### Parameters - **log** (KLogger) - Optional logger instance. Defaults to a default logger. - **rate** (Duration) - Required. The rate at which tokens are added to the bucket. - **callVolumeUnit** (CallVolumeUnit) - Optional. Defines the unit of volume for calls or bytes. Defaults to `CallVolumeUnit.Calls()`. - **capacity** (Int) - Required. The maximum capacity of the bucket. - **clock** ( () -> Long) - Optional. A function that provides the current time in milliseconds. Defaults to the system clock. ``` -------------------------------- ### KafkaFileConfig Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-kafka-file-config Initializes KafkaFileConfig with the provided ApplicationConfig. ```APIDOC ## KafkaFileConfig constructor ### Description Initializes the KafkaFileConfig with the given application configuration. ### Parameters * **config** (ApplicationConfig) - The application configuration to use. ``` -------------------------------- ### TokenBucket Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter.implementations/-token-bucket/-token-bucket Initializes a new instance of the TokenBucket class with specified rate, capacity, and optional logger and clock. ```APIDOC ## TokenBucket Constructor ### Description Initializes a new instance of the TokenBucket class. This constructor allows for customization of the rate limiting behavior by specifying the rate, call volume unit, capacity, and an optional clock function. ### Parameters - **log** (KLogger) - Optional - The logger instance to use for logging. - **rate** (Duration) - Required - The rate at which tokens are refilled. - **callVolumeUnit** (CallVolumeUnit) - Optional - The unit used to measure call volume, defaults to `CallVolumeUnit.Calls()`. - **capacity** (Int) - Required - The maximum number of tokens the bucket can hold. - **clock** ( () -> Long ) - Optional - A function that returns the current time in milliseconds, defaults to the system clock. ``` -------------------------------- ### TaskSchedulingPluginTest Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling/-task-scheduling-plugin-test/-task-scheduling-plugin-test Initializes a new instance of the TaskSchedulingPluginTest class. ```APIDOC ## TaskSchedulingPluginTest() ### Description Initializes a new instance of the TaskSchedulingPluginTest class. ### Constructor `TaskSchedulingPluginTest()` ``` -------------------------------- ### Accessing the Ktor Application Instance Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers/-task-manager/application The `application` property provides direct access to the Ktor `Application` instance. This is useful for advanced configurations or when you need to interact with Ktor's core functionalities from your task scheduling logic. ```APIDOC ## Accessing the Ktor Application Instance ### Description Provides access to the underlying Ktor `Application` instance. ### Property - `application`: `Application` - The Ktor `Application` instance. ``` -------------------------------- ### autoOffsetReset Property Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-consumer-properties-builder/auto-offset-reset Configures the auto offset reset policy for the Kafka consumer. This determines what the consumer does when it starts up and cannot find a valid offset for a partition it is assigned to. Common values include 'earliest' (reset to the beginning of the log) or 'latest' (reset to the end of the log). ```APIDOC ## autoOffsetReset ### Description Configures the auto offset reset policy for the Kafka consumer. This determines what the consumer does when it starts up and cannot find a valid offset for a partition it is assigned to. Common values include 'earliest' (reset to the beginning of the log) or 'latest' (reset to the end of the log). ### Property `autoOffsetReset: Any?` ### Usage Example ```kotlin consumer { autoOffsetReset = "earliest" } ``` ``` -------------------------------- ### build() Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-consumer-properties-builder Builds and returns the KafkaProperties object based on the configured builder settings. ```APIDOC ## Function build() [jvm] open override fun build(): KafkaProperties ### Description Constructs and returns the final KafkaProperties object after all configurations have been applied. ### Returns - KafkaProperties - The configured Kafka properties. ``` -------------------------------- ### SchemaRegistrationBuilder Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-schema-registration-builder Initializes a new instance of the SchemaRegistrationBuilder. ```APIDOC ## SchemaRegistrationBuilder() ### Description Constructs a new SchemaRegistrationBuilder. ### Constructor `SchemaRegistrationBuilder()` ``` -------------------------------- ### init Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers.lock.database/-jdbc-lock-manager Initializes the task lock manager with a list of tasks. This method is typically called during application startup. ```APIDOC ## init ### Description Initializes the task lock manager with a list of tasks. ### Parameters * **tasks** (List) - The list of tasks to initialize. ``` -------------------------------- ### SlidingWindow Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter.implementations/-sliding-window Initializes a SlidingWindow rate limiter. Configure the rate, maximum capacity, and how call volume is measured. An optional custom clock can be provided. ```kotlin data class SlidingWindow(val rate: Duration, val capacity: Int, val callVolumeUnit: CallVolumeUnit, val clock: () -> Long = { now() .toEpochMilliseconds() }) : RateLimiter ``` -------------------------------- ### Configure Kafka Plugin via Code DSL Source: https://flaxoos.github.io/extra-ktor-plugins/ktor-server-kafka Use the Kafka plugin's DSL to programmatically configure Kafka settings, including schema registry URL, topic details, common client configurations, and specific settings for admin, producer, and consumer clients. This method allows for fine-grained control over Kafka integration within your Ktor application. ```kotlin install(Kafka) { schemaRegistryUrl = listOf("my.schemaRegistryUrl") topic(named("my-topic")) { partitions = 1 replicas = 1 configs { messageTimestampType = CreateTime } } common { // <-- Define common configs bootstrapServers = listOf("my-kafka") retries = 1 clientId = "my-client-id" } admin { } // <-- Creates an admin client producer { // <-- Creates a producer clientId = "my-client-id" } consumer { // <-- Creates a consumer groupId = "my-group-id" clientId = "my-client-id-override" //<-- Override common configurations } consumerConfig { consumerRecordHandler(named("my-topic")) { record -> myService.save(record) } } registerSchemas { using { // <-- optionally provide a client, by default CIO is used HttpClient() } MyRecord::class at named("my-topic") // <-- Will register schema upon startup } } ``` -------------------------------- ### SlidingWindow Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter.implementations/-sliding-window/-sliding-window Initializes a new instance of the SlidingWindow rate limiter. ```APIDOC ## SlidingWindow Constructor ### Description Constructs a new SlidingWindow rate limiter with the specified rate, capacity, and call volume unit. An optional clock function can be provided for custom time tracking. ### Parameters * **rate** (Duration) - The time duration for the sliding window. * **capacity** (Int) - The maximum number of calls allowed within the rate duration. * **callVolumeUnit** (CallVolumeUnit) - The unit used to measure call volume. * **clock** (() -> Long) - Optional. A function that returns the current time in milliseconds. Defaults to the current system time. ``` -------------------------------- ### Add Ktor Server Task Scheduling Plugin Source: https://flaxoos.github.io/extra-ktor-plugins/guide/installation Integrate the Ktor server task scheduling plugin by adding its dependency. Replace `$module` and `$ktor_plugins_version` with your specific module name and the plugin version. ```gradle implementation("io.github.flaxoos:ktor-server-task-scheduling-$module:$ktor_plugins_version") ``` -------------------------------- ### build() Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-client-properties-builder/build Builds and returns a mutable map of client properties. This method is intended to be overridden by subclasses to provide specific client configurations. ```APIDOC ## build() ### Description Builds and returns a mutable map containing the client properties. ### Signature ```kotlin open override fun build(): MutableMap ``` ### Returns A `MutableMap` representing the client properties. ``` -------------------------------- ### TopicPropertiesBuilder Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-topic-properties-builder/-topic-properties-builder Initializes a new instance of the TopicPropertiesBuilder class. ```APIDOC ## TopicPropertiesBuilder() ### Description This is the default constructor for the TopicPropertiesBuilder. ### Constructor TopicPropertiesBuilder() ### Parameters None ``` -------------------------------- ### RedisTaskLockManagerConfiguration Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers.lock.redis/-redis-task-lock-manager-configuration/-redis-task-lock-manager-configuration Initializes the RedisTaskLockManagerConfiguration with connection details and lock parameters. ```APIDOC ## RedisTaskLockManagerConfiguration Constructor ### Description Initializes the Redis task lock manager configuration. ### Parameters #### Constructor Parameters - **host** (String) - Optional - The hostname of the Redis server. Defaults to "undefined". - **port** (Int) - Optional - The port of the Redis server. Defaults to 0. - **username** (String?) - Optional - The username for Redis authentication. Defaults to null. - **password** (String?) - Optional - The password for Redis authentication. Defaults to null. - **lockExpirationMs** (Long) - Optional - The duration in milliseconds for which a lock is valid. Defaults to 100. - **connectionPoolInitialSize** (Int) - Optional - The initial size of the connection pool. Defaults to 10. - **connectionPoolMaxSize** (Int) - Optional - The maximum size of the connection pool. Defaults to connectionPoolInitialSize. - **connectionAcquisitionTimeoutMs** (Long) - Optional - The timeout in milliseconds for acquiring a connection from the pool. Defaults to 100. ``` -------------------------------- ### AdminPropertiesBuilder Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-admin-properties-builder Initializes a new instance of the AdminPropertiesBuilder class. ```APIDOC ## AdminPropertiesBuilder() ### Description Constructs a new AdminPropertiesBuilder with default settings. ### Constructor `AdminPropertiesBuilder()` ``` -------------------------------- ### SchemaRegistryClient Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka.components/-schema-registry-client/-schema-registry-client Initializes a new instance of the SchemaRegistryClient. This client is used to manage schemas with a Schema Registry. ```APIDOC ## SchemaRegistryClient Constructor ### Description Initializes a new instance of the SchemaRegistryClient with the provided HttpClient, Schema Registry URL, and timeout. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Constructor Signature ```kotlin constructor(providedClient: HttpClient, schemaRegistryUrl: String, timeoutMs: Long) ``` ### Parameters * **providedClient** (HttpClient) - The HttpClient instance to use for making requests. * **schemaRegistryUrl** (String) - The base URL of the Schema Registry. * **timeoutMs** (Long) - The timeout in milliseconds for Schema Registry operations. ``` -------------------------------- ### build() Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-consumer-properties-builder/build Constructs and returns the KafkaProperties object based on the builder's configuration. ```APIDOC ## build() ### Description Constructs and returns the KafkaProperties object based on the builder's configuration. ### Signature ```kotlin open override fun build(): KafkaProperties ``` ### Returns A KafkaProperties object representing the configured Kafka properties. ``` -------------------------------- ### TaskConfiguration Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling/-task-configuration/-task-configuration Initializes a new instance of the TaskConfiguration class. ```APIDOC ## TaskConfiguration() ### Description This is the default constructor for the `TaskConfiguration` class. It initializes a new instance with default settings. ### Constructor `TaskConfiguration()` ``` -------------------------------- ### KafkaConfig() Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-kafka-config/-kafka-config The default constructor for KafkaConfig. Use this to set up Kafka producer and consumer configurations. ```APIDOC ## KafkaConfig() ### Description Initializes a new instance of the `KafkaConfig` class with default settings. This constructor is used to configure Kafka producer and consumer properties within the Ktor server. ### Constructor `KafkaConfig()` ### Usage ```kotlin kafka { // Configure Kafka properties here // For example: // producer { // bootstrapServers = "localhost:9092" // } // consumer { // groupId = "my-group" // } } ``` ``` -------------------------------- ### SchemaRegistrationBuilder.using Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-schema-registration-builder Provides a custom HttpClient for schema registration. ```APIDOC ## using(provider: () -> HttpClient) ### Description Optionally provides a custom `HttpClient` for registering schemas. If not provided, the default CIO client will be used. The client will be configured with JSON serialization and the `AbstractKafkaConfig.schemaRegistrationTimeoutMs`. ### Method Signature `fun using(provider: () -> HttpClient)` ### Parameters - **provider** ( () -> HttpClient ) - A function that returns an `HttpClient` instance. ``` -------------------------------- ### Add Ktor Server Kafka Plugin Source: https://flaxoos.github.io/extra-ktor-plugins/guide/installation Include the Ktor server Kafka plugin by adding its dependency to your Gradle build file. Ensure you replace `$ktor_plugins_version` with the actual version. ```gradle implementation("io.github.flaxoos:ktor-server-kafka:$ktor_plugins_version") ``` -------------------------------- ### Detailed RateLimiting Configuration Options Source: https://flaxoos.github.io/extra-ktor-plugins/ktor-server-rate-limiting Configure various aspects of the RateLimiting plugin, including the rate limiter strategy, capacity, clock, call volume unit, whitelisting/blacklisting rules, and custom handlers for accepted calls and exceeded limits. ```kotlin install(RateLimiting) { // Configuring Rate Limiter type = TokenBucket::class, // Using Token Bucket rate limiting strategy rate = 10.milliseconds, // 1 token is added per 10 milliseconds capacity = 1000, // Up to 1000 tokens can be held for bursty traffic clock = { Clock.System.now().toEpochMilliseconds() }, // Using system time callVolumeUnit = CallVolumeUnit.Calls() // Measuring by the number of API calls ) // Whitelisting Configurations whiteListedHosts = setOf("192.168.1.1") // IP address exempted from rate limiting whiteListedPrincipals = setOf(Principal("trustedUser")) // Trusted user with unrestricted access whiteListedAgents = setOf("trusted-agent") // A user-agent that is allowed unrestricted access // Blacklisting Configurations blackListedHosts = setOf("192.168.1.2") // IP address completely restricted from API access blackListedPrincipals = setOf(Principal("maliciousUser")) // User that is denied access to the API blackListedAgents = setOf("malicious-agent") // A user-agent that is blocked from making API calls // Handlers blackListedCallerCallHandler = { call -> // Respond with a 403 Forbidden status to blacklisted callers call.respond(HttpStatusCode.Forbidden, "You are blacklisted and cannot access the API.") } callAcceptedHandler = { notLimited -> // Add rate-limiting headers for accepted calls response.headers.append("X-RateLimit-Remaining", "${notLimited.remaining}") response.headers.append("X-RateLimit-Measured-by", notLimited.rateLimiter.callVolumeUnit.name) } rateLimitExceededHandler = { limitedBy -> // Respond with a 429 status and appropriate headers for rate-limited callers response.headers.append("X-RateLimit-Limit", "${limitedBy.rateLimiter.capacity}") response.headers.append("X-RateLimit-Measured-by", limitedBy.rateLimiter.callVolumeUnit.name) response.headers.append("X-RateLimit-Reset", "${limitedBy.resetIn.inWholeMilliseconds}") respond(HttpStatusCode.TooManyRequests, "Rate limit exceeded: ${limitedBy.message}") } ``` -------------------------------- ### RateLimitingConfiguration Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter/-rate-limiting-configuration/-rate-limiting-configuration The default constructor for RateLimitingConfiguration. It initializes the configuration with default values. ```APIDOC ## RateLimitingConfiguration() ### Description Initializes a new instance of the `RateLimitingConfiguration` class with default settings. ### Constructor `RateLimitingConfiguration()` ### Parameters None ``` -------------------------------- ### ConsumerPropertiesBuilder Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-consumer-properties-builder/-consumer-properties-builder Initializes a new instance of the ConsumerPropertiesBuilder class. Optionally configures the Schema Registry URL. ```APIDOC ## ConsumerPropertiesBuilder constructor ### Description Initializes a new instance of the ConsumerPropertiesBuilder class. ### Signature ```kotlin constructor(schemaRegistryUrl: String? = null) ``` ### Parameters #### Path Parameters - **schemaRegistryUrl** (String?) - Optional - The URL of the Schema Registry. Defaults to null. ``` -------------------------------- ### ProducerPropertiesBuilder Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-producer-properties-builder/-producer-properties-builder Initializes a new instance of the ProducerPropertiesBuilder class. Optionally configures the schema registry URL. ```APIDOC ## ProducerPropertiesBuilder Constructor ### Description Initializes a new instance of the ProducerPropertiesBuilder class. This builder is used to configure properties for Kafka producers. ### Signature ```kotlin constructor(schemaRegistryUrl: String? = null) ``` ### Parameters * **schemaRegistryUrl** (String?) - Optional. The URL of the schema registry to use for Avro serialization. If not provided, schema registry integration might be disabled or default to a local setup. ``` -------------------------------- ### tryAccept Function Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter.implementations/-leaky-bucket Attempts to accept an incoming call. If the bucket is full, the call will be suspended until space becomes available. ```APIDOC ## tryAccept Function ### Description Attempts to accept a call based on the rate limiter's configuration. If the bucket is not full, the call is accepted immediately. If the bucket is full, the call will be suspended until a slot is available according to the defined rate. ### Signature ```kotlin open suspend override fun tryAccept(call: ApplicationCall): RateLimiterResponse ``` ### Parameters * `call` (ApplicationCall) - The incoming call to be evaluated by the rate limiter. ### Returns * `RateLimiterResponse` - Indicates whether the call was accepted or rejected. ``` -------------------------------- ### MongoDBJobLockManagerConfiguration Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers.lock.database/-mongo-d-b-job-lock-manager-configuration Initializes a new instance of the MongoDBJobLockManagerConfiguration class. ```APIDOC ## MongoDBJobLockManagerConfiguration() ### Description Constructs a new MongoDBJobLockManagerConfiguration with default settings. ### Constructor ```kotlin constructor() ``` ``` -------------------------------- ### tryAccept Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter.implementations/-token-bucket Attempts to accept an incoming call based on the token bucket's current state. ```APIDOC ## tryAccept ### Description Attempts to accept an incoming `ApplicationCall`. This method checks if there are enough tokens in the bucket to allow the call to proceed. Returns a `RateLimiterResponse` indicating success or failure. ### Method `suspend fun tryAccept(call: ApplicationCall): RateLimiterResponse` ### Parameters - **call** (ApplicationCall) - The incoming call to evaluate for acceptance. ``` -------------------------------- ### KafkaPropertiesBuilder.build() Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-kafka-properties-builder Builds the KafkaProperties object. This is an abstract function that must be implemented by inheritors. ```APIDOC ## KafkaPropertiesBuilder.build() ### Description Builds the KafkaProperties object. This function is abstract and requires implementation by subclasses. ### Signature ```kotlin abstract fun build(): KafkaProperties ``` ### Returns - `KafkaProperties`: The constructed Kafka properties object. ``` -------------------------------- ### KafkaFileConfig Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-kafka-file-config/-kafka-file-config The KafkaFileConfig constructor takes an ApplicationConfig object to load Kafka configurations. ```APIDOC ## KafkaFileConfig constructor ### Description Initializes a new instance of the KafkaFileConfig class. ### Signature ```kotlin constructor(config: ApplicationConfig) ``` ### Parameters #### Parameters - **config** (ApplicationConfig) - The application configuration object from which to load Kafka settings. ``` -------------------------------- ### Set Partitions Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-topic-builder/partitions Configures the number of partitions for the Kafka topic. This is a JVM-specific setting. ```APIDOC ## partitions ### Description Sets the number of partitions for the Kafka topic. ### JVM Property `partitions` (Int) - The desired number of partitions. ``` -------------------------------- ### host() Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers/-task-manager/-companion/host Retrieves the host string associated with the TaskManager. ```APIDOC ## host() ### Description Retrieves the host string. ### Signature ```kotlin fun Application.host(): String ``` ``` -------------------------------- ### TaskSchedulingConfiguration Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling/-task-scheduling-configuration/-task-scheduling-configuration The default constructor for TaskSchedulingConfiguration. This is used to initialize the configuration with default settings. ```APIDOC ## TaskSchedulingConfiguration() ### Description Initializes a new instance of the `TaskSchedulingConfiguration` class with default settings. ### Constructor `TaskSchedulingConfiguration()` ### Parameters None ``` -------------------------------- ### AbstractKafkaConfig Functions Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-abstract-kafka-config Functions for configuring Kafka consumer and registering schemas. ```APIDOC ## Functions ### `consumerConfig` - **Signature**: `fun AbstractKafkaConfig.consumerConfig(configuration: KafkaConsumerConfig.() -> Unit = { })` - **Description**: Configures the Kafka consumer using a lambda receiver for `KafkaConsumerConfig`. ### `registerSchemas` - **Signature**: `fun AbstractKafkaConfig.registerSchemas(configuration: SchemaRegistrationBuilder.() -> Unit = { SchemaRegistrationBuilder() })` - **Description**: Registers Kafka schemas using a `SchemaRegistrationBuilder`. ``` -------------------------------- ### initTaskLockTable Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers.lock.database/-database-task-lock-manager/init-task-lock-table Creates the task lock key table in the database. This is a prerequisite for using the task scheduling lock manager. ```APIDOC ## initTaskLockTable ### Description Creates the task lock key table in the database. ### Method `suspend fun initTaskLockTable()` ### Parameters This function does not take any parameters. ### Returns This function does not return any value. ``` -------------------------------- ### tryAdd Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter.implementations/-concurrent-fixed-size-weighted-queue/try-add Attempts to add an element to the queue with an optional weight. Returns true if the element was added successfully, false otherwise. The default weight is 1.0. ```APIDOC ## tryAdd ### Description Attempts to add an element to the queue with an optional weight. Returns true if the element was added successfully, false otherwise. ### Signature `fun tryAdd(t: T, weight: Double = 1.0): Boolean` ### Parameters - **t** (T) - The element to add to the queue. - **weight** (Double) - The weight of the element to add. Defaults to 1.0. ### Returns - **Boolean** - `true` if the element was added successfully, `false` otherwise. ``` -------------------------------- ### KafkaConsumerConfig Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-kafka-consumer-config/-kafka-consumer-config The default constructor for KafkaConsumerConfig. ```APIDOC ## KafkaConsumerConfig() ### Description Initializes a new instance of the `KafkaConsumerConfig` class with default settings. ### Constructor `KafkaConsumerConfig()` ``` -------------------------------- ### Add Ktor Client Circuit Breaker Plugin Source: https://flaxoos.github.io/extra-ktor-plugins/guide/installation Incorporate the Ktor client circuit breaker plugin by adding its dependency. Make sure to specify the correct `$ktor_plugins_version`. ```gradle implementation("io.github.flaxoos:ktor-client-circuit-breaker:$ktor_plugins_version") ``` -------------------------------- ### TaskManager Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers/-task-manager/-task-manager Initializes a new instance of the TaskManager class. ```APIDOC ## TaskManager() ### Description This is the default constructor for the TaskManager class. It is used to create an instance of the TaskManager without any initial configuration. ### Method constructor() ### Parameters None ``` -------------------------------- ### tryAccept Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter/-rate-limiter/try-accept Attempts to accept an ApplicationCall, returning a RateLimiterResponse detailing the outcome. ```APIDOC ## tryAccept ### Description Try to accept a call. ### Parameters - **call** (ApplicationCall) - The call to accept. ### Return Response detailing if the call was accepted and details in the case of rejection. ``` -------------------------------- ### RateLimiterConfiguration Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter/-rate-limiting-configuration/-rate-limiter-configuration Configures the rate limiter with various parameters. You can specify the rate limiter implementation type, the rate at which requests are allowed, the capacity of the limiter, a custom clock function, and the unit for measuring call volume. ```APIDOC ## RateLimiterConfiguration Constructor ### Description Initializes a new instance of the `RateLimiterConfiguration` class. ### Parameters - **type** (KClass) - Optional - The rate limiter implementation class. Defaults to `TokenBucket::class`. - **rate** (Duration) - Optional - The rate at which requests are allowed. Defaults to `INFINITE`. - **capacity** (Int) - Optional - The maximum capacity of the rate limiter. Defaults to `Int.MAX_VALUE`. - **clock** (() -> Long) - Optional - A function that provides the current time in milliseconds. Defaults to a function returning the current epoch milliseconds. - **callVolumeUnit** (CallVolumeUnit) - Optional - The unit by which the rate limiter capacity is measured. Defaults to `CallVolumeUnit.Calls()`. ``` -------------------------------- ### ClientPropertiesBuilder.build() Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-client-properties-builder The `build` function is an override that constructs and returns a mutable map of string to any, representing the Kafka client properties. ```APIDOC ## Function ### build - **Signature**: `open override fun build(): MutableMap` - **Description**: Builds and returns the Kafka client properties as a mutable map. ``` -------------------------------- ### TopicBuilder Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-topic-builder/-topic-builder Initializes a new instance of the TopicBuilder class with a specified topic name. ```APIDOC ## TopicBuilder Constructor ### Description Initializes a new instance of the TopicBuilder class. ### Signature ```kotlin constructor(name: TopicName) ``` ### Parameters * **name** (TopicName) - The name of the topic to build. ``` -------------------------------- ### build() Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-topic-properties-builder/build This function is part of the TopicPropertiesBuilder and is responsible for constructing the final KafkaProperties object. It's an override function, suggesting it implements a method from a superclass or interface. ```APIDOC ## build() ### Description Constructs and returns the KafkaProperties object based on the builder's configuration. ### Method Signature `open override fun build(): KafkaProperties` ### Parameters This method does not take any parameters. ### Returns - `KafkaProperties`: An object containing the configured Kafka properties. ``` -------------------------------- ### CommonClientPropertiesBuilder.build() Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-common-client-properties-builder The build function constructs a mutable map of String to Any? representing the client properties. ```APIDOC ## build() Constructs a mutable map of client properties. ### Signature ```kotlin open override fun build(): MutableMap ``` ### Returns A `MutableMap` containing the configured client properties. ``` -------------------------------- ### metricsSampleWindowMs Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-client-properties-builder/metrics-sample-window-ms Configures the sampling window for metrics in milliseconds. This property is of type Any? and is specific to the JVM. ```APIDOC ## Property: metricsSampleWindowMs ### Description Configures the sampling window for metrics in milliseconds. ### Type Any? ### Platform JVM ``` -------------------------------- ### AdminPropertiesBuilder.build() Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-admin-properties-builder Builds and returns a mutable map of Kafka admin client properties. ```APIDOC ## build() ### Description Compiles the configured properties into a `MutableMap` suitable for use with the Kafka admin client. ### Function Signature `open override fun build(): MutableMap` ``` -------------------------------- ### TopicBuilder Configuration Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-topic-builder This snippet demonstrates how to use the TopicBuilder to define Kafka topic properties such as partitions, replicas, and custom configurations. ```APIDOC ## TopicBuilder [jvm] class TopicBuilder(name: TopicName) ### Properties - **partitions** (var partitions: Int): Configures the number of partitions for the topic. - **replicas** (var replicas: Short): Configures the number of replicas for the topic. - **replicasAssignments** (var replicasAssignments: Map>?): Allows for custom replica assignments per partition. ### Functions - **configs** (fun configs(config: TopicPropertiesBuilder.() -> Unit)): Applies custom configurations to the topic using a builder pattern. ``` -------------------------------- ### bootstrapServers Property Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-client-properties-builder/bootstrap-servers Configures the list of bootstrap servers for the Kafka client. This is a required property for establishing a connection to the Kafka cluster. ```APIDOC ## bootstrapServers [jvm]\nvar bootstrapServers: Any?\n ### Description Configures the list of bootstrap servers for the Kafka client. This is a required property for establishing a connection to the Kafka cluster. ### Property - **bootstrapServers** (Any?): The list of Kafka bootstrap server addresses. ``` -------------------------------- ### createSchemaRegistryClient Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka.components Factory function to create an instance of SchemaRegistryClient. ```APIDOC ## fun createSchemaRegistryClient ### Description Creates a new SchemaRegistryClient. ### Parameters - `schemaRegistryUrl` (String) - The URL of the schema registry. - `timeoutMs` (Long) - The timeout for operations in milliseconds. - `clientProvider` (() -> HttpClient) - A function that provides an HttpClient instance. ``` -------------------------------- ### tryAdd Function Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter.implementations/-concurrent-fixed-size-weighted-queue Attempts to add an entry to the queue with an optional weight. ```APIDOC ## tryAdd Function ### Description Attempts to add an entry to the queue if there is enough capacity based on its weight. ### Parameters - **t** (T) - The entry to add to the queue. - **weight** (Double) - The weight of the entry. Defaults to 1.0. ### Returns - Boolean - True if the entry was successfully added, false otherwise. ``` -------------------------------- ### TopicName.Companion.named Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-topic-name/-companion Creates a TopicName instance with a specific name. ```APIDOC ## TopicName.Companion.named ### Description Creates a TopicName instance with a specific name. ### Signature ```kotlin infix fun named(name: String): TopicName ``` ### Parameters #### Path Parameters - **name** (String) - The name of the topic. ``` -------------------------------- ### froMap Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.kafka/-topic-builder/-companion Creates a TopicBuilder from a map of string to any. ```APIDOC ## froMap ### Description Creates a TopicBuilder instance from a map. ### Function Signature ```kotlin fun froMap(map: Map): TopicBuilder ``` ### Parameters * `map` (Map) - A map containing configuration for the TopicBuilder. ``` -------------------------------- ### ExposedTaskLockTable Constructor Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers.lock.database/-exposed-task-lock-table/-exposed-task-lock-table Initializes a new instance of the ExposedTaskLockTable class with a specified table name. ```APIDOC ## ExposedTaskLockTable constructor ### Description Initializes a new instance of the `ExposedTaskLockTable` class. ### Parameters #### Path Parameters - **tableName** (String) - Required - The name of the database table to use for storing task locks. ``` -------------------------------- ### initTaskLockTable Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling.managers.lock.database/-database-task-lock-manager Initializes the database table used for storing task lock information. This is an abstract method that must be implemented by concrete subclasses. ```APIDOC ## initTaskLockTable ### Description Create the task lock key table in the database. ### Signature abstract suspend fun initTaskLockTable() ### Returns - Unit ``` -------------------------------- ### TaskSchedulingConfiguration Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.taskscheduling Configuration class for the TaskScheduling plugin. ```APIDOC ## TaskSchedulingConfiguration ### Description This class holds the configuration options for the TaskScheduling plugin. ### Type `class TaskConfiguration` ### Fields - `taskFreqMs` (TaskFreqMs): The frequency in milliseconds for task execution checks. ``` -------------------------------- ### SlidingWindow tryAccept Function Source: https://flaxoos.github.io/extra-ktor-plugins/dokka/extra-ktor-plugins/io.github.flaxoos.ktor.server.plugins.ratelimiter.implementations/-sliding-window Attempts to accept an incoming call based on the configured rate limiting policy. Returns a RateLimiterResponse indicating success or failure. ```kotlin open suspend override fun tryAccept(call: ApplicationCall): RateLimiterResponse ```