go-queue icon indicating copy to clipboard operation
go-queue copied to clipboard

push.close() 后程序退出丢失消息

Open Meppo opened this issue 1 year ago • 0 comments

go version go1.19.2 linux/amd64
  • 示例
package main

import (
	"fmt"
	"log"
	"time"

	"github.com/zeromicro/go-queue/kq"
)

func main() {

	push := kq.NewPusher([]string{"localhost:9092"}, "pushtest",
		kq.WithChunkSize(5000000),
		kq.WithFlushInterval(5 * time.Second))
	defer push.Close()

	for i:=0; i<10; i++ {
		err := push.Push(fmt.Sprintf("Hello world: %d", i))
		if err != nil {
			log.Panic(err)
		}
	}

}

Meppo avatar Nov 01 '22 08:11 Meppo