完善gkafka示例程序

This commit is contained in:
john
2018-06-20 11:48:56 +08:00
parent 2d0d7f5a8f
commit 5f04287573
3 changed files with 5 additions and 5 deletions

View File

@ -1,10 +1,10 @@
// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved.
// Copyright 2018 gf Author(https://gitee.com/johng/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://gitee.com/johng/gf.
// Kafka客户端.
// Kafka Client.
package gkafka
import (
@ -42,7 +42,7 @@ type Message struct {
// New a kafka client.
func New(config *Config) *Client {
func NewClient(config *Config) *Client {
return &Client {
Config : config,
}

View File

@ -12,7 +12,7 @@ func main () {
config.Servers = "localhost:9092"
config.Topics = "test"
client := gkafka.New(config)
client := gkafka.NewClient(config)
defer client.Close()
for {

View File

@ -10,7 +10,7 @@ func main () {
config.Servers = "localhost:9092"
config.Topics = "test"
client := gkafka.New(config)
client := gkafka.NewClient(config)
defer client.Close()
err := client.SyncSend(&gkafka.Message{Value: []byte("1")})
fmt.Println(err)