Skip to content

Commit

Permalink
Implementations for final
Browse files Browse the repository at this point in the history
  • Loading branch information
ispiroglu committed Jul 5, 2023
1 parent b72ed49 commit 4bf1408
Show file tree
Hide file tree
Showing 3 changed files with 324 additions and 2 deletions.
53 changes: 53 additions & 0 deletions cmd/mercurius-client/publisher-client/mercurius-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,56 @@ func main() {
wg.Wait()
time.Sleep(1 * time.Hour)
}

// package main

// import (
// "context"
// "fmt"
// "strconv"
// "sync"
// "sync/atomic"
// "time"

// logger2 "github.com/ispiroglu/mercurius/internal/logger"
// "github.com/ispiroglu/mercurius/pkg/client"
// "go.uber.org/zap"
// )

// const ADDR = "0.0.0.0:9000"
// const TopicName = "one-to-one"
// const CLIENT_NAME = "Sample Client"

// var logger = logger2.NewLogger()
// var messageCount = atomic.Uint64{}
// var N = 1

// func main() {
// c, err := client.NewClient(CLIENT_NAME, ADDR)
// if err != nil {
// logger.Error("Err", zap.Error(err))
// }

// logger.Info("Published Event")

// wg := sync.WaitGroup{}
// wg.Add(N)

// for i := 0; i < N; i++ {
// go func(w *sync.WaitGroup) {
// for j := 0; j < 100; j++ {
// if err := c.Publish(strconv.Itoa(j), []byte(strconv.FormatUint(messageCount.Load(), 10)), context.Background()); err != nil {
// logger.Error("Err", zap.Error(err))
// }
// fmt.Println(strconv.FormatUint(messageCount.Load(), 10))

// messageCount.Add(1)
// }
// w.Done()
// }(&wg)
// }

// wg.Wait()

// time.Sleep(1 * time.Hour)
// }
Loading

0 comments on commit 4bf1408

Please sign in to comment.