An asynchronous Scala wrapper around the Apache Curator Framework.
Note: Use artifactId scurator_2.10
if you want to use with Scala 2.10
// Add needed imports
import org.apache.curator.framework.CuratorFrameworkFactory
import org.apache.curator.retry.RetryOneTime
import org.scurator.SCuratorClient
import org.scurator.components._
import scala.util.{Failure, Success}
import scala.concurrent.ExecutionContext.Implicits.global
// Create and start a curator client
val curator = CuratorFrameworkFactory.newClient("localhost:2181", new RetryOneTime(1))
curator.start()
// Wrap the instance with SCuratorClient
val client = SCuratorClient(curator)
// Call create on the SCuratorClient
val create = client.create(CreateRequest(path = "/foo"))
// Handle the future response
create.onComplete {
case Success(response) => println(s"Created node: ${response.path}")
case Failure(ex) => println(s"Failed: ${ex.getMessage}")
}
Note: This project uses Gradle. You must install Gradle(2.8). If you would rather not install Gradle locally you can use the Gradle Wrapper by replacing all references to
gradle
withgradlew
.
- Execute
gradle build
- Find the artifact jars in './/build/libs/'
- Execute
gradle idea
- Open project folder in Intellij or open the generated .ipr file
Note: If you have any issues in Intellij a good first troubleshooting step is to execute
gradle cleanIdea idea
- Execute
gradle eclipse
- Open the project folder in Eclipse
Note: If you have any issues in Eclipse a good first troubleshooting step is to execute
gradle cleanEclipse eclipse
- Creating nodes with no data does not utilize default data (curator defaults data to the local IP address).
- The relevant path is included in all responses