async publish
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2020-05-22 03:57:24 +02:00
parent ffed92fe39
commit e699b878e0
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -6,7 +6,11 @@ import com.kmalbz.api.model.SampleObject
import com.kmalbz.database.service.IInputObjectService import com.kmalbz.database.service.IInputObjectService
import com.rabbitmq.client.BuiltinExchangeType import com.rabbitmq.client.BuiltinExchangeType
import com.rabbitmq.client.ConnectionFactory import com.rabbitmq.client.ConnectionFactory
import com.rabbitmq.client.MessageProperties
import com.typesafe.config.ConfigFactory import com.typesafe.config.ConfigFactory
import com.viartemev.thewhiterabbit.channel.confirmChannel
import com.viartemev.thewhiterabbit.channel.publish
import com.viartemev.thewhiterabbit.publisher.OutboundMessage
import io.ktor.application.call import io.ktor.application.call
import io.ktor.config.HoconApplicationConfig import io.ktor.config.HoconApplicationConfig
import io.ktor.http.HttpStatusCode import io.ktor.http.HttpStatusCode
@ -96,7 +100,11 @@ class InputServiceServer {
resultObjectService.addOne(currentApiObject) resultObjectService.addOne(currentApiObject)
} }
channel.basicPublish(rabbitExchangeName,"" , null, tag.toString().toByteArray()) connection.confirmChannel {
publish {
publishWithConfirm(OutboundMessage(rabbitExchangeName, "", MessageProperties.PERSISTENT_BASIC, tag.toString()))
}
}
call.respond(currentApiObject) call.respond(currentApiObject)
} }