Skip to content

Commit ae9db1b

Browse files
authored
Fix document (#195)
1 parent 210544e commit ae9db1b

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

README.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,25 +101,16 @@ The `Harvester` builder pattern is used to create a `Harvester` instance. The bu
101101
- Redis monitor, for setting up monitoring from Redis
102102

103103
```go
104-
h, err := New(&cfg).
105-
WithConsulSeed("address", "dc", "token").
106-
WithConsulMonitor("address", "dc", "token").
107-
WithRedisSeed(redisClient).
108-
WithRedisMonitor(redisClient, 10*time.Millisecond).
109-
Create()
104+
h, err := harvester.New(&cfg, chNotify,
105+
harvester.WithConsulSeed(consulAddress, consulDC, consulToken, 0),
106+
harvester.WithConsulMonitor(consulAddress, consulDC, consulToken, 0),
107+
harvester.WithRedisSeed(redisClient),
108+
harvester.WithRedisMonitor(redisClient, 200*time.Millisecond),
109+
)
110110
```
111111

112112
The above snippet set's up a `Harvester` instance with Consul and Redis seed and monitor.
113113

114-
## Notification support
115-
116-
In order to be able to monitor the changes in the configuration we provide a way to notify when a change is happening via the builder.
117-
118-
```go
119-
h, err := harvester.New(&cfg).WithNotification(chNotify).Create()
120-
...
121-
```
122-
123114
## Consul
124115

125116
Consul has support for versioning (`ModifyIndex`) which allows us to change the value only if the version is higher than the one currently.

examples/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func main() {
6060

6161
go func() {
6262
for change := range chNotify {
63-
log.Printf("notification: " + change.String())
63+
log.Printf("notification: %s", change.String())
6464
}
6565
wg.Done()
6666
}()

0 commit comments

Comments
 (0)