Grails ZooKeeper Helper Plugin
Java Groovy
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
grails-app
lib
scripts
src/java/com/jbrisbin/vpc/zk
test/integration
web-app/WEB-INF
.gitignore
LICENSE.txt
README.markdown
ZooKeeperGrailsPlugin.groovy
application.properties

README.markdown

Grails ZooKeeper Plugin

This is a port of the GroovyZooKeeperHelper that is part of my Virutal Private Cloud Utilities:

http://github.com/jbrisbin/vpc-utils

It allows you to interact with ZooKeeper in a more Grails-friendly way:

class MyController {

  // Auto-injected by the plugin
  def zooKeeper

  def action = {
    zooKeeper.onDataChanged = { evt ->
      // We're interested in data changing while we're watching
      println "data changed: ${evt}"
    }
    if (!zooKeeper.exists("/my/node/parent")) {
      zooKeeper.createPersistentNodeAndParents("/my/node/parent")
    }
    node = zooKeeper.createPersistentNode("/my/node/parent/child")
    node.data = 12345
  }

}

Configuration

To use the ZooKeeper helper with your own ZooKeeper servers, you need to specify a valid ZooKeeper URL in your Config.groovy:

zooKeeper.url = "localhost:2181"
zooKeeper.timeout = 20000

Documentation

http://jbrisbin.github.com/grails-zookeeper-plugin/