From e699b878e0e97e1ab486c622ee77ed3ef9bc4b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Fri, 22 May 2020 03:57:24 +0200 Subject: [PATCH] async publish --- src/api/route/InputServiceServer.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/api/route/InputServiceServer.kt b/src/api/route/InputServiceServer.kt index e626c07..047ae4f 100644 --- a/src/api/route/InputServiceServer.kt +++ b/src/api/route/InputServiceServer.kt @@ -6,7 +6,11 @@ import com.kmalbz.api.model.SampleObject import com.kmalbz.database.service.IInputObjectService import com.rabbitmq.client.BuiltinExchangeType import com.rabbitmq.client.ConnectionFactory +import com.rabbitmq.client.MessageProperties 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.config.HoconApplicationConfig import io.ktor.http.HttpStatusCode @@ -96,7 +100,11 @@ class InputServiceServer { resultObjectService.addOne(currentApiObject) } - channel.basicPublish(rabbitExchangeName,"" , null, tag.toString().toByteArray()) + connection.confirmChannel { + publish { + publishWithConfirm(OutboundMessage(rabbitExchangeName, "", MessageProperties.PERSISTENT_BASIC, tag.toString())) + } + } call.respond(currentApiObject) }