@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
AttachmentContent attachment = exchange.getAttachment(AttachmentContent.KEY);
int timeout = attachment.getTopic().isReplicationConfirmRequired() ? longAsyncTimeout : defaultAsyncTimeout;
attachment.setTimeoutHolder(new TimeoutHolder(
timeout,
exchange.getIoThread().executeAfter(
() -> runTimeoutHandler(exchange, attachment),
timeout,
MILLISECONDS)));
ThroughputLimiter.QuotaInsight quotaInsight = throughputLimiter.checkQuota(
attachment.getCachedTopic().getTopicName(),
attachment.getCachedTopic().getThroughput());
if (quotaInsight.hasQuota()) {
readMessage(exchange, attachment);
} else {
respondWithQuotaViolation(exchange, attachment, quotaInsight.getReason());
}
}