Git Product home page Git Product logo

zkschemaregistry's Introduction

zkSchemaRegistry

A zookeeper registry which allows applications to keep track of which schemas other applications are running.

This is very helpful if you want to namespace memcached [https://github.com/vallancelee/hibernate-memcached] with a schema such that you can avoid memcached poisoning. The basic overview is that when an application starts up it creates a cache of all other schemas for all applications running. When all other currently running applicaitons are notified that an application with a new schema is about to start, then then only you can start.

Basic API

When starting an application call SchemaRegistryCache.start(schemaVersion, processIdentifer, ttl)

now you will register with zookeeper, this class also contains the cache where you can check active running schemas at anytime using Set getActiveSchemas()

There is a listener setup to watch for new ZNodes and automatically update your cache.

The basic design of the ZNode directory structure is as follows

  • schema

    • [someSchemaVersion]
      • processA
      • processB
  • process

    • processA : data {someSchemaVersion,someOtherSchemaVersion}
    • processB : data {someSchemaVersion,someOtherSchemaVersion}
    • processC : data {someSchemaVersion,someOtherSchemaVersion}

All nodes are ephermeral except for the schema version nodes. Those are cleaned up by a reaper. The reason for this is if a server restarts or you take downtime you do not necessarily want the caches to clear immediately for all other nodes. That is why you pass the ttl into the start method of SchemaRegistryCache. When a particular schemaVersion has no children (all the child ephemeral nodes are gone), a ttl is written as the data for that zNode and the reaper will check to see if there have been no children for that znode and the ttl has passed to remove that schema zNode and all caches will update.

zkschemaregistry's People

Watchers

xiashuijun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.