All checks were successful
continuous-integration/drone/push Build is passing
26 lines
782 B
Kotlin
26 lines
782 B
Kotlin
package worker
|
|
|
|
import config.EnvConfig
|
|
import com.rabbitmq.client.*
|
|
import consumer.GlueConsumer
|
|
|
|
|
|
class Glue {
|
|
val envConfig = EnvConfig()
|
|
|
|
fun recieve(){
|
|
val factory = ConnectionFactory()
|
|
factory.host = envConfig.mqHost
|
|
factory.username = envConfig.mqUserName
|
|
factory.password = envConfig.mqPassWord
|
|
|
|
val inputConnection = factory.newConnection()
|
|
val inputChannel = inputConnection.createChannel()
|
|
|
|
inputChannel.exchangeDeclare(envConfig.mqInputExchange, BuiltinExchangeType.FANOUT)
|
|
val inputQueueName = inputChannel.queueDeclare().queue
|
|
inputChannel.queueBind(inputQueueName, envConfig.mqInputExchange, "")
|
|
|
|
inputChannel.basicConsume(envConfig.mqInputExchange, true, GlueConsumer())
|
|
}
|
|
} |