From d86f1f79c3818e6e51876c23c661837b3146fbf3 Mon Sep 17 00:00:00 2001 From: Lorenzo Venerandi Date: Sat, 14 Dec 2024 02:26:48 +0100 Subject: [PATCH] removed useless stuff --- messaging.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/messaging.go b/messaging.go index 17269fe..b13c542 100644 --- a/messaging.go +++ b/messaging.go @@ -6,6 +6,7 @@ import ( "gitea.rebus.ninja/lore/wasm-nats-producer-client/gen/wasmcloud/messaging/types" logger "gitea.rebus.ninja/lore/wasm-nats-producer-client/gen/wasi/logging/logging" //config "gitea.rebus.ninja/lore/wasm-nats-producer-client/gen/wasi/config/runtime" + "time" ) type messagingConsumerAdapter struct { @@ -22,12 +23,13 @@ func loop() cm.Result[string, struct{}, string] { // TODO implement the logic to get the destination topic from the config // dest_topic := config.GetAll() dest_topic := "test.reply" + counter := 0 // TASK - for true { + for { // generate random message - data := []byte("Hello, World!") + data := []byte("Hello, World! " + string(counter)) // Send reply reply := types.BrokerMessage{ @@ -41,6 +43,15 @@ func loop() cm.Result[string, struct{}, string] { return res } + counter++ + + if counter == 1000 { + break + } + + // sleep for 1 second + time.Sleep(1 * time.Second) + } return cm.OK[cm.Result[string, struct{}, string]](struct{}{})