Class SubjectVersionsResourceImpl

  • All Implemented Interfaces:
    SubjectVersionsResource

    @Counted(name="rest_request_count",
             description="Total number of REST requests.",
             tags={"group=REST","metric=rest_request_count"})
    @ConcurrentGauge(name="concurrent_request_count",
                     description="Number of concurrent REST requests.",
                     tags={"group=REST","metric=concurrent_request_count"})
    @Timed(name="rest_response_time",
           description="Time of a request-response interval.",
           tags={"group=REST","metric=rest_response_time"},
           unit="milliseconds")
    public class SubjectVersionsResourceImpl
    extends AbstractResource
    implements SubjectVersionsResource
    Author:
    Ales Justin, Jakub Senko 'jsenko@redhat.com'
    • Constructor Detail

      • SubjectVersionsResourceImpl

        public SubjectVersionsResourceImpl()
    • Method Detail

      • listVersions

        public List<Integer> listVersions​(String subject)
                                   throws Exception
        Description copied from interface: SubjectVersionsResource
        Get a list of versions registered under the specified subject.

        Parameters:

        • subject (string) – the name of the subject
        Response JSON Array of Objects:
        • version (int) – version of the schema registered under this subject
        Status Codes:
        • 404 Not Found
          • Error code 40401 – Subject not found
        • 500 Internal Server Error
          • Error code 50001 – Error in the backend datastore
        Specified by:
        listVersions in interface SubjectVersionsResource
        Throws:
        Exception
      • register

        public void register​(String subject,
                             SchemaInfo request,
                             javax.ws.rs.container.AsyncResponse response)
                      throws Exception
        Description copied from interface: SubjectVersionsResource
        Register a new schema under the specified subject. If successfully registered, this returns the unique identifier of this schema in the registry. The returned identifier should be used to retrieve this schema from the schemas resource and is different from the schema’s version which is associated with the subject. If the same schema is registered under a different subject, the same identifier will be returned. However, the version of the schema may be different under different subjects. A schema should be compatible with the previously registered schema or schemas (if there are any) as per the configured compatibility level. The configured compatibility level can be obtained by issuing a GET http:get:: /config/(string: subject). If that returns null, then GET http:get:: /config When there are multiple instances of Schema Registry running in the same cluster, the schema registration request will be forwarded to one of the instances designated as the primary. If the primary is not available, the client will get an error code indicating that the forwarding has failed. Parameters: subject (string) – Subject under which the schema will be registered Request JSON Object: schema – The schema string Status Codes: 409 Conflict – Incompatible schema 422 Unprocessable Entity – Error code 42201 – Invalid schema 500 Internal Server Error – Error code 50001 – Error in the backend data store Error code 50002 – Operation timed out Error code 50003 – Error while forwarding the request to the primary
        Specified by:
        register in interface SubjectVersionsResource
        Throws:
        Exception
      • getSchemaByVersion

        public Schema getSchemaByVersion​(String subject,
                                         String version)
                                  throws Exception
        Description copied from interface: SubjectVersionsResource
        Get a specific version of the schema registered under this subject Parameters: subject (string) – Name of the subject version (versionId) – Version of the schema to be returned. Valid values for versionId are between [1,2^31-1] or the string “latest”. “latest” returns the last registered schema under the specified subject. Note that there may be a new latest schema that gets registered right after this request is served. Response JSON Object: subject (string) – Name of the subject that this schema is registered under globalId (int) – Globally unique identifier of the schema version (int) – Version of the returned schema schema (string) – The schema string Status Codes: 404 Not Found – Error code 40401 – Subject not found Error code 40402 – Version not found 422 Unprocessable Entity – Error code 42202 – Invalid version 500 Internal Server Error – Error code 50001 – Error in the backend data store
        Specified by:
        getSchemaByVersion in interface SubjectVersionsResource
        Throws:
        Exception
      • deleteSchemaVersion

        public int deleteSchemaVersion​(String subject,
                                       String version)
                                throws Exception
        Description copied from interface: SubjectVersionsResource
        Deletes a specific version of the schema registered under this subject. This only deletes the version and the schema ID remains intact making it still possible to decode data using the schema ID. This API is recommended to be used only in development environments or under extreme circumstances where-in, its required to delete a previously registered schema for compatibility purposes or re-register previously registered schema. Parameters: subject (string) – Name of the subject version (versionId) – Version of the schema to be deleted. Valid values for versionId are between [1,2^31-1] or the string “latest”. “latest” deletes the last registered schema under the specified subject. Note that there may be a new latest schema that gets registered right after this request is served. Response JSON Object: int – Version of the deleted schema Status Codes: 404 Not Found – Error code 40401 – Subject not found Error code 40402 – Version not found 422 Unprocessable Entity – Error code 42202 – Invalid version 500 Internal Server Error – Error code 50001 – Error in the backend data store
        Specified by:
        deleteSchemaVersion in interface SubjectVersionsResource
        Throws:
        Exception
      • getSchemaOnly

        public String getSchemaOnly​(String subject,
                                    String version)
                             throws Exception
        Description copied from interface: SubjectVersionsResource
        Get the schema for the specified version of this subject. The unescaped schema only is returned. Parameters: subject (string) – Name of the subject version (versionId) – Version of the schema to be returned. Valid values for versionId are between [1,2^31-1] or the string “latest”. “latest” returns the last registered schema under the specified subject. Note that there may be a new latest schema that gets registered right after this request is served. Response JSON Object: schema (string) – The schema string (unescaped) Status Codes: 404 Not Found – Error code 40401 – Subject not found Error code 40402 – Version not found 422 Unprocessable Entity – Error code 42202 – Invalid version 500 Internal Server Error – Error code 50001 – Error in the backend data store
        Specified by:
        getSchemaOnly in interface SubjectVersionsResource
        Throws:
        Exception
      • getSchemasReferencedBy

        public List<Integer> getSchemasReferencedBy​(String subject,
                                                    Integer version)
                                             throws Exception
        Description copied from interface: SubjectVersionsResource
        Get a list of IDs of schemas that reference the schema with the given subject and version. Parameters: subject (string) – the name of the subject version (versionId) – Version of the schema to be returned. Valid values for versionId are between [1,2^31-1] or the string “latest”. “latest” returns the last registered schema under the specified subject. Note that there may be a new latest schema that gets registered right after this request is served. Response JSON Array of Objects: id (int) – Globally unique identifier of the schema Status Codes: 404 Not Found – Error code 40401 – Subject not found 500 Internal Server Error – Error code 50001 – Error in the backend datastore
        Specified by:
        getSchemasReferencedBy in interface SubjectVersionsResource
        Throws:
        Exception