updated log messages and removed AddSchema function
This commit is contained in:
4
main.go
4
main.go
@@ -72,10 +72,10 @@ func main() {
|
||||
httpServer, err1 := server.NewServer(port, cors)
|
||||
metricsServer, err2 := server.MetricServer(METRICS_PORT)
|
||||
if err1 != nil {
|
||||
logger.Fatal("Unable to start server, %v", zap.String("error", err1.Error()))
|
||||
logger.Fatal("Unable to start server, %v", zap.Error(err1))
|
||||
}
|
||||
if err2 != nil {
|
||||
logger.Fatal("Unable to start Metric server, %v", zap.String("error", err2.Error()))
|
||||
logger.Fatal("Unable to start Metric server, %v", zap.Error(err2))
|
||||
}
|
||||
go httpServer.HttpServer.Serve(httpServer.Listener)
|
||||
go metricsServer.HttpServer.Serve(metricsServer.Listener)
|
||||
|
||||
@@ -39,28 +39,3 @@ func GetSchemaVersions() {
|
||||
}
|
||||
logger.Debug("Schema Version Map", zap.String("", fmt.Sprintf("%v", SchemaVersionMap)))
|
||||
}
|
||||
|
||||
func AddSchema(topic string, schemaType string, schema string) error {
|
||||
|
||||
schemaRegistryClient := srclient.CreateSchemaRegistryClient(SchemaRegistryEndpoint)
|
||||
schemaRegistryClient.CodecCreationEnabled(false)
|
||||
existingSchema, _ := schemaRegistryClient.GetLatestSchema(topic, false)
|
||||
logger.Debug("EXISTINGSCHEMA", zap.String("", fmt.Sprintf("%v", existingSchema)))
|
||||
|
||||
if existingSchema != nil {
|
||||
compatible, errorCompatible := schemaRegistryClient.IsSchemaCompatible(topic, schema, "latest", srclient.SchemaType(schemaType), false)
|
||||
if errorCompatible != nil {
|
||||
return errorCompatible
|
||||
} else if compatible == false {
|
||||
return fmt.Errorf("given schema not compatible with the latest version")
|
||||
}
|
||||
}
|
||||
|
||||
_, errroCreate := schemaRegistryClient.CreateSchema(topic, schema, srclient.SchemaType(schemaType), false)
|
||||
|
||||
if errroCreate != nil {
|
||||
return errroCreate
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user