import reactor.core.publisher.ReplayProcessor
import reactor.netty.NettyOutbound
import reactor.netty.tcp.TcpClient
+ import reactor.util.concurrent.Queues.XS_BUFFER_SIZE
/**
* @author Jakub Dudycz <jakub.dudycz@nokia.com>
class VesHvClient(private val configuration: SimulatorConfiguration) {
private val client: TcpClient = TcpClient.create()
- .host(configuration.vesHost)
- .port(configuration.vesPort)
+ .addressSupplier { configuration.hvVesAddress }
.configureSsl()
private fun TcpClient.configureSsl() =
.handle { _, output -> handler(complete, messages, output) }
.connect()
.doOnError {
- logger.info {
- "Failed to connect to VesHvCollector on ${configuration.vesHost}:${configuration.vesPort}"
- }
+ logger.info { "Failed to connect to VesHvCollector on ${configuration.hvVesAddress}" }
}
.subscribe {
- logger.info {
- "Connected to VesHvCollector on ${configuration.vesHost}:${configuration.vesPort}"
- }
+ logger.info { "Connected to VesHvCollector on ${configuration.hvVesAddress}" }
}
return complete.then()
}
val encoder = WireFrameEncoder(allocator)
val frames = messages
.map(encoder::encode)
- .window(MAX_BATCH_SIZE)
+ .window(XS_BUFFER_SIZE)
return nettyOutbound
.logConnectionClosed()
companion object {
private val logger = Logger(VesHvClient::class)
- private const val MAX_BATCH_SIZE = 128
}
}