Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Meppo opened this issue Nov 1, 2022 · 0 comments
Open

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

Meppo opened this issue Nov 1, 2022 · 0 comments

Comments

@Meppo
Copy link

Meppo commented Nov 1, 2022

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)
		}
	}

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant