From 3bce92358c90cc5901f94d08f35e7612f2faa5fe Mon Sep 17 00:00:00 2001 From: Lorenzo Venerandi Date: Sat, 4 Jan 2025 23:58:12 +0100 Subject: [PATCH] Delete messaging.go --- messaging.go | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 messaging.go diff --git a/messaging.go b/messaging.go deleted file mode 100644 index 934d929..0000000 --- a/messaging.go +++ /dev/null @@ -1,44 +0,0 @@ -package main - -import ( - "github.com/bytecodealliance/wasm-tools-go/cm" - "gitea.rebus.ninja/lore/wasm-nats-stream-client/gen/wasmcloud/messaging/consumer" - "gitea.rebus.ninja/lore/wasm-nats-stream-client/gen/wasmcloud/messaging/types" - logger "gitea.rebus.ninja/lore/wasm-nats-stream-client/gen/wasi/logging/logging" - //config "gitea.rebus.ninja/lore/go-nats-client/gen/wasi/config/runtime" -) - -type messagingConsumerAdapter struct { - Publish func(msg types.BrokerMessage) (result cm.Result[string, struct{}, string]) -} - -// NOTE(lxf): this is overridden in tests -var messagingConsumer = &messagingConsumerAdapter{ - Publish: consumer.Publish, -} - -func handleMessage(msg types.BrokerMessage) cm.Result[string, struct{}, string] { - - logger.Log(logger.LevelInfo,"MessageHandler", "Received message on subject" + msg.Subject) - - // TODO implement the logic to get the destination topic from the config - // dest_topic := config.GetAll() - dest_topic := "finish" - - // TASK - - - // Send reply - reply := types.BrokerMessage{ - Subject: dest_topic, - Body: msg.Body, - ReplyTo: cm.None[string](), - } - res := messagingConsumer.Publish(reply) - if res.IsErr() { - logger.Log(logger.LevelError, "MessageHandler", "Failed to send reply, error: " + *res.Err()) - return res - } - - return cm.OK[cm.Result[string, struct{}, string]](struct{}{}) -}