io.leonard.amqp.rpc.client.RPCClientImpl.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of amqp-scala-client_2.12 Show documentation
Show all versions of amqp-scala-client_2.12 Show documentation
Scala wrapper for rabbitmq-java-client
The newest version!
package io.leonard.amqp.rpc.client
import io.leonard.amqp._
import io.leonard.amqp.properties.Key.{ CorrelationId, ReplyTo }
import scala.concurrent.Future
import scala.concurrent.duration.FiniteDuration
private[amqp] class RPCClientImpl(publishChannel: ChannelOwner, responseController: ResponseController) extends RPCClient {
override def newMethod(routingDescriptor: RoutingDescriptor, timeout: FiniteDuration): RPCMethod =
new RPCMethodImpl(routingDescriptor, timeout)
class RPCMethodImpl(routingDescriptor: RoutingDescriptor, timeout: FiniteDuration) extends RPCMethod {
override def apply(message: Message): Future[Message] = {
val ResponseSpec(correlationId, replyTo, response, onReturn) = responseController.prepareResponse(timeout)
publishChannel.send(routingDescriptor, message.withProperties(CorrelationId → correlationId, ReplyTo → replyTo), onReturn, timeout)
response
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy