-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.go
51 lines (47 loc) · 1.12 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"github.com/Trendyol/go-dcp-couchbase"
"time"
"github.com/Trendyol/go-dcp-couchbase/config"
dcpConfig "github.com/Trendyol/go-dcp/config"
)
func main() {
c, err := dcpcouchbase.NewConnectorBuilder(&config.Config{
Dcp: dcpConfig.Dcp{
Hosts: []string{"localhost:8091"},
Username: "user",
Password: "password",
BucketName: "dcp-test",
Dcp: dcpConfig.ExternalDcp{
Group: dcpConfig.DCPGroup{
Name: "groupName",
Membership: dcpConfig.DCPGroupMembership{
RebalanceDelay: 3 * time.Second,
},
},
},
Metadata: dcpConfig.Metadata{
Config: map[string]string{
"bucket": "dcp-test-meta",
"scope": "_default",
"collection": "_default",
},
Type: "couchbase",
},
Debug: true,
},
Couchbase: config.Couchbase{
Hosts: []string{"localhost:8091"},
Username: "user",
Password: "password",
BucketName: "dcp-test-backup",
BatchSizeLimit: 10,
RequestTimeout: 10 * time.Second,
},
}).SetMapper(dcpcouchbase.DefaultMapper).Build()
if err != nil {
panic(err)
}
defer c.Close()
c.Start()
}