All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tanukkii.reactivezk.CreateAsyncCallback.scala Maven / Gradle / Ivy

The newest version!
package tanukkii.reactivezk

import akka.actor.{Actor, ActorRef}
import tanukkii.reactivezk.ZKOperations.{CreateFailure, Created}

trait CreateAsyncCallback {
  import KeeperExceptionConverter._

  def createAsyncCallback(implicit sender: ActorRef = Actor.noSender): (Int, String, ContextEnvelope, String) => Unit = {
    (rc: Int, path: String, ctx: ContextEnvelope, name: String) => rc.toKeeperExceptionOpt(path) match {
      case Some(e) => ctx.sender ! CreateFailure(e, path, ctx.originalCtx)
      case None => ctx.sender ! Created(path, name, ctx.originalCtx)
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy