code: public synchronized MD5Digest register(Schema schema, PostMethod post) throws SchemaRegistryException {
  
      // Change namespace if override specified
      if (this.namespaceOverride.isPresent()) {
        schema = AvroUtils.switchNamespace(schema, this.namespaceOverride.get());
      }
  
      LOG.info("Registering schema " + schema.toString());
  
      post.addParameter("schema", schema.toString());
  
      HttpClient httpClient = this.borrowClient();
      try {
        LOG.debug("Loading: " + post.getURI());
        int statusCode = httpClient.executeMethod(post);
        if (statusCode != HttpStatus.SC_CREATED) {
          throw new SchemaRegistryException("Error occurred while trying to register schema: " + statusCode);
        }
  
        String response;
        response = post.getResponseBodyAsString();
        if (response != null) {
          LOG.info("Received response " + response);
        }
  
        String schemaKey;
        Header[] headers = post.getResponseHeaders(SCHEMA_ID_HEADER_NAME);
        if (headers.length != 1) {
          throw new SchemaRegistryException(
              "Error reading schema id returned by registerSchema call: headers.length = " + headers.length);
        } else if (!headers[0].getValue().startsWith(SCHEMA_ID_HEADER_PREFIX)) {
          throw new SchemaRegistryException(
              "Error parsing schema id returned by registerSchema call: header = " + headers[0].getValue());
        } else {
          LOG.info("Registered schema successfully");
          schemaKey = headers[0].getValue().substring(SCHEMA_ID_HEADER_PREFIX.length());
        }
        MD5Digest schemaId = MD5Digest.fromString(schemaKey);
        return schemaId;
      } catch (Throwable t) {
        throw new SchemaRegistryException(t);
      } finally {
        post.releaseConnection();
        this.httpClientPool.returnObject(httpClient);
      }
    }
docs: Register a schema to the Kafka schema registry
  
  @param schema
  @param post
  @return schema ID of the registered schema
  @throws SchemaRegistryException if registration failed