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

com.github.lemfi.kest.rabbitmq.model.RabbitMQProperties.kt Maven / Gradle / Ivy

There is a newer version: 0.8.1
Show newest version
package com.github.lemfi.kest.rabbitmq.model

import com.github.lemfi.kest.core.logger.LoggerFactory
import com.github.lemfi.kest.core.properties.property

internal data class RabbitMQProperties(
    val rabbitmq: RabbitMQProp
)

internal data class RabbitMQProp(
    val connection: String = "amqp://guest:guest@localhost:5672",
    val managementapi: RabbitMQManagementApiProp = RabbitMQManagementApiProp(),
    val vhost: String = "/",
    val exchange: String = "",
)

internal data class RabbitMQManagementApiProp(
    val connection: String = "http://localhost:15672",
    val user: String = "guest",
    val password: String = "guest"
)

internal fun  rabbitMQProperty(l: RabbitMQProp.() -> R): R {
    val shortcut: RabbitMQProperties.() -> R = { rabbitmq.l() }
    return try {
        property(shortcut)
    } catch (e: Throwable) {
        LoggerFactory.getLogger("RABBITMQ-Kest").debug("No configuration found for rabbitmq, use default values")
        RabbitMQProp().l()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy