eventcsp

module
v0.0.0-...-247ba60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2022 License: MIT

README

eventcsp

Used to collect send process events

example


import (
	"context"
	"fmt"
	"os"
	"os/signal"
	"strconv"
	"syscall"

	event "github.com/diwangtseb/eventcsp/event/pkg"
)

func main() {
	dsn := "root:123456@tcp(127.0.0.1:3306)/event?charset=utf8mb4"
	buffer := 10
	e := event.NewEvent(dsn, buffer, nil)

	go func() {
		for i := 0; i < 10; i++ {
			e.Collect(context.Background(), event.Msg{
				Name:    strconv.Itoa(i),
				Contetn: "hello world",
			})
		}
	}()
	go e.StartProcess()
	ch := make(chan os.Signal, 1)
	signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
	fmt.Println("exit", <-ch)
}

Directories

Path Synopsis
event
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL