com.github.lemfi.kest.rabbitmq.executor.RabbitMQQueueDeletionExecution.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of step-rabbitmq Show documentation
Show all versions of step-rabbitmq Show documentation
Backends testing with Kotlin
package com.github.lemfi.kest.rabbitmq.executor
import com.github.lemfi.kest.core.logger.LoggerFactory
import com.github.lemfi.kest.core.model.Execution
import com.rabbitmq.client.ConnectionFactory
import java.net.URLEncoder
internal class RabbitMQQueueDeletionExecution(
private val queue: String,
private val connection: String,
private val vhost: String,
) : Execution() {
private val encodedVhost: String = URLEncoder.encode(vhost, Charsets.UTF_8)
override fun execute() {
LoggerFactory.getLogger("RABBITMQ-Kest")
.info(
"""
|Queue deletion:
|
|vhost: $vhost
|name: $queue
""".trimMargin()
)
ConnectionFactory().also {
it.setUri("$connection/$encodedVhost")
}
.newConnection("kest connection")
.createChannel()
.apply {
queueDelete(queue)
}
.connection.close()
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy