Schema Registry is the RESTFul repository to store schema.
The schema registered at Schema Registry is used with kakfa and camus.
- register schema
- get schema
It uses jersery-1.9 for the compatibility with hadoop-2.6.
It uses the mysql as a metastore.
$ mvn clean package assembly:single
$ ls -l repo/target/schema-registry-repo-{version}-distro.tar.gz
Untar the disto tar such as schema-registry-repo-{version}-distro.tar.gz
REPO_HOME will be repo-0.9-SNAPSHOT
$ tar xzvf schema-registry-repo-0.9-SNAPSHOT-distro.tar.gz
$ cd repo-0.9-SNAPSHOT
$ bin/repo.sh start (|stop)
Revise the config in the bin/env.sh file.
GET /schema/ids/{string: id}
Get the schema info identified by the id
Parameters:
- id (string) - the unique identifier of the schema
Response JSON Object:
- id(string) - the id
- created(string) - created time in milliseconds
- schemaStr(string) - schema string identified by the id
Status Codes:
- 404 Not Found
- 500 Internal Server Error
GET /subjects
Get a list of registered subjects
Response JSON Array Object:
list of schema info
- id(string) - the id
- created(string) - created time in milliseconds
- schemaStr(string) - schema string identified by the id
Status Codes:
- 500 Internal Server Error
GET /subjects/{string: subject}
Get the latest subject identified by the subject name
Parameters:
- subject (string) - the name of the subject
Response JSON Object:
- id(string) - the id
- created(string) - created time in milliseconds
- schemaStr(string) - schema string identified by the id
Status Codes:
- 404 Not Found
- 500 Internal Server Error
GET /subjects/{string: subject}/ids/{string: id}
Get the subject identified by the subject name and id
Parameters:
- subject (string) - the name of the subject
- id (string) - the unique identifier
Response JSON Object:
- id(string) - the id
- created(string) - created time in milliseconds
- schemaStr(string) - schema string identified by the id
Status Codes:
- 404 Not Found
- 500 Internal Server Error
POST /subjects/{string: subject}
Register a new schema under the specified subject. If the schema string is equal to the latest schema, return the latest schema info.
Parameters:
- subject (string) - the name of the subject
- schema(string) - schema string
Response JSON Object:
- id(string) - the id
- created(string) - created time in milliseconds
- schemaStr(string) - schema string identified by the id
Status Codes:
- 404 Not Found
- 500 Internal Server Error
Use easymock for the test cases.