forked from tryfix/schemaregistry
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
39 lines (30 loc) · 814 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Copyright 2020 TryFix Engineering.
* All rights reserved.
* Authors:
* Gayan Yapa (gmbyapa@gmail.com)
*/
package main
import (
"time"
"github.com/HADLakmal/schemaregistry"
"github.com/tryfix/log"
)
func main() {
// init a new schema registry instance and connect
registry, err := schemaregistry.NewRegistry(`localhost:8089/`,
schemaregistry.WithBackgroundSync([]string{`localhost:9092`}, `__schemas`))
if err != nil {
log.Fatal(err)
}
if err := registry.Register(`com.org.events.test.TestTwo`, 1, func(decoder schemaregistry.AvroDecoder, data []byte) (v interface{}, err error) {
return nil, nil
}); err != nil {
log.Fatal(err)
}
if err = registry.Sync(); err != nil {
log.Fatal(err)
}
log.Info(`your event is successfully registered`)
time.Sleep(10 * time.Minute)
}