39 lines
613 B
Go
39 lines
613 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
|
|
"11-11.dev/goexamples/elasticstream"
|
|
)
|
|
|
|
func main() {
|
|
config := &elasticstream.Config{
|
|
Host: "http://test.urantiacloud.com:9200",
|
|
Indexes: []string{"IndexA", "IndexB", "IndexC"},
|
|
BatchSize: 10,
|
|
}
|
|
|
|
client, err := elasticstream.NewClient(config)
|
|
if err != nil {
|
|
log.Println("elasticstream.NewClient() err:", err)
|
|
return
|
|
}
|
|
|
|
err = client.Open()
|
|
if err != nil {
|
|
log.Println("client.Open() err:", err)
|
|
return
|
|
}
|
|
|
|
for {
|
|
data, err := client.Read()
|
|
if err != nil {
|
|
log.Println("eclient.Read() err:", err)
|
|
continue
|
|
}
|
|
|
|
fmt.Println(data)
|
|
}
|
|
}
|