feat: update

This commit is contained in:
sujit
2024-10-13 11:02:55 +05:45
parent f5ce142544
commit 2f39fb40d7
6 changed files with 54 additions and 17 deletions

View File

@@ -3,24 +3,25 @@ package main
import (
"context"
"fmt"
mq2 "github.com/oarkflow/mq"
"time"
"github.com/oarkflow/mq"
)
func main() {
payload := []byte(`{"message":"Message Publisher \n Task"}`)
task := mq2.Task{
payload := []byte(`{"user_id": 2, "age": 34}`)
task := mq.Task{
Payload: payload,
}
publisher := mq2.NewPublisher("publish-1")
publisher := mq.NewPublisher("publish-1")
// publisher := mq.NewPublisher("publish-1", mq.WithTLS(true, "./certs/server.crt", "./certs/server.key"))
err := publisher.Publish(context.Background(), task, "queue1")
if err != nil {
panic(err)
}
fmt.Println("Async task published successfully")
payload = []byte(`{"message":"Fire-and-Forget \n Task"}`)
task = mq2.Task{
payload = []byte(`{"user_id": 2, "age": 34}`)
task = mq.Task{
Payload: payload,
}
for i := 0; i < 100; i++ {