Skip to content

Instantly share code, notes, and snippets.

View davidrwood's full-sized avatar

David Wood davidrwood

View GitHub Profile
@johanandren
johanandren / RateLimit.scala
Created July 14, 2017 10:05
Sample for a custom rate limiting directive for Akka HTTP
/**
* Copyright (C) 2009-2017 Lightbend Inc. <http://www.lightbend.com>
*/
package http
import java.util.concurrent.atomic.AtomicInteger
import akka.actor.{Actor, ActorRef, ActorSystem, Props}
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.{HttpResponse, StatusCodes, Uri}