org.schemarepo.zookeeper
Class ZooKeeperRepository
java.lang.Object
org.schemarepo.BaseRepository
org.schemarepo.AbstractBackendRepository
org.schemarepo.zookeeper.ZooKeeperRepository
- All Implemented Interfaces:
- Closeable, Repository
public class ZooKeeperRepository
- extends AbstractBackendRepository
This Repository implementation stores its state using Zookeeper.
It requires the schema-repo.zookeeper.ensemble configuration property. This is
a comma-separated list of host:port addresses. Each address can also be suffixed
by a namespace, i.e.: zk.1:2181/schemas,zk.2:2181/schemas,zk.3:2181/schemas
This Repository is meant to be highly available, meaning that multiple instances
can share the same Zookeeper ensemble and synchronize their state through it.
ZooKeeperRepository
@Inject
public ZooKeeperRepository(@Named(value="schema-repo.zookeeper.ensemble")
String zkEnsemble,
@Named(value="schema-repo.zookeeper.path-prefix")
String zkPathPrefix,
@Named(value="schema-repo.zookeeper.session-timeout")
Integer zkSessionTimeout,
@Named(value="schema-repo.zookeeper.connection-timeout")
Integer zkConnectionTimeout,
@Named(value="schema-repo.zookeeper.curator.sleep-time-between-retries")
Integer curatorSleepTimeBetweenRetries,
@Named(value="schema-repo.zookeeper.curator.number-of-retries")
Integer curatorNumberOfRetries,
ValidatorFactory validators)
getSubjectInstance
protected Subject getSubjectInstance(String subjectName)
- Specified by:
getSubjectInstance in class AbstractBackendRepository
registerSubjectInBackend
protected void registerSubjectInBackend(String subjectName,
SubjectConfig config)
- Specified by:
registerSubjectInBackend in class AbstractBackendRepository
checkSubjectExistsInBackend
protected boolean checkSubjectExistsInBackend(String subjectName)
- Overrides:
checkSubjectExistsInBackend in class AbstractBackendRepository
subjects
public Iterable<Subject> subjects()
- Specified by:
subjects in interface Repository- Overrides:
subjects in class AbstractBackendRepository
close
public void close()
throws IOException
- Closes this stream and releases any system resources associated
with it. If the stream is already closed then invoking this
method has no effect.
- Specified by:
close in interface Closeable- Overrides:
close in class BaseRepository
- Throws:
IOException - if an I/O error occurs
isValid
public void isValid()
- Overrides:
isValid in class BaseRepository
exposeConfiguration
protected Map<String,String> exposeConfiguration()
- Overrides:
exposeConfiguration in class BaseRepository
Copyright © 2015. All rights reserved.