kemichal / function-queue   1.0.0

MIT License GitHub

Run Scala functions in a queue

Scala versions: 2.12 2.11

function-queue Scaladex License

function-queue is a collection of classes for queueing up execution of functions in Scala.

AsyncFunctionQueue

Allows you to add functions to a queue which is then executed sequentially in Futures.

val asyncFunctionQueue = new AsyncFunctionQueue()
asyncFunctionQueue.add {
  println("Hello world")
}

AsyncUniqueFunctionQueue

Similar to AsyncFunctionQueue, but the functions added must have a unique key to be accepted into the queue.

val asyncUniqueFunctionQueue = new AsyncUniqueFunctionQueue[String]()
asyncUniqueFunctionQueue.add("1") {
  println("Hello world")
}