Compare commits
2 Commits
8ba95bfe0c
...
cdc80d0b53
Author | SHA1 | Date | |
---|---|---|---|
cdc80d0b53 | |||
d86f1f79c3 |
@ -49,4 +49,4 @@ WORKDIR /app
|
|||||||
|
|
||||||
# Install go dependencies, build the wasm module, push it to the registry
|
# Install go dependencies, build the wasm module, push it to the registry
|
||||||
#CMD ["sh", "-c", "go mod download && go mod verify && go mod tidy && wash build && wash push $REGISTRY build/*_s.wasm"]
|
#CMD ["sh", "-c", "go mod download && go mod verify && go mod tidy && wash build && wash push $REGISTRY build/*_s.wasm"]
|
||||||
CMD ["sh", "-c", "go env -w GOFLAGS=-buildvcs=false && go mod download && go mod verify && wash build && wash push $REGISTRY build/*_s.wasm"]
|
CMD ["sh", "-c", "go env -w GOFLAGS=-buildvcs=false && go mod download && go mod verify && wash build && wash push $REGISTRY build/*.wasm"]
|
50
go.mod
50
go.mod
@ -1,25 +1,25 @@
|
|||||||
module gitea.rebus.ninja/lore/wasm-nats-producer-client
|
module gitea.rebus.ninja/lore/wasm-nats-producer-client
|
||||||
|
|
||||||
go 1.23.0
|
go 1.23.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bytecodealliance/wasm-tools-go v0.3.2
|
github.com/bytecodealliance/wasm-tools-go v0.3.2
|
||||||
go.wasmcloud.dev/component v0.0.5
|
go.wasmcloud.dev/component v0.0.5
|
||||||
go.wasmcloud.dev/wadge v0.7.0
|
go.wasmcloud.dev/wadge v0.7.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/coreos/go-semver v0.3.1 // indirect
|
github.com/coreos/go-semver v0.3.1 // indirect
|
||||||
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
|
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
|
||||||
github.com/klauspost/compress v1.17.11 // indirect
|
github.com/klauspost/compress v1.17.11 // indirect
|
||||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||||
github.com/regclient/regclient v0.8.0 // indirect
|
github.com/regclient/regclient v0.8.0 // indirect
|
||||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||||
github.com/ulikunitz/xz v0.5.12 // indirect
|
github.com/ulikunitz/xz v0.5.12 // indirect
|
||||||
github.com/urfave/cli/v3 v3.0.0-beta1 // indirect
|
github.com/urfave/cli/v3 v3.0.0-beta1 // indirect
|
||||||
go.bytecodealliance.org v0.4.1 // indirect
|
go.bytecodealliance.org v0.4.1 // indirect
|
||||||
golang.org/x/mod v0.22.0 // indirect
|
golang.org/x/mod v0.22.0 // indirect
|
||||||
golang.org/x/sync v0.10.0 // indirect
|
golang.org/x/sync v0.10.0 // indirect
|
||||||
golang.org/x/sys v0.28.0 // indirect
|
golang.org/x/sys v0.28.0 // indirect
|
||||||
golang.org/x/tools v0.28.0 // indirect
|
golang.org/x/tools v0.28.0 // indirect
|
||||||
)
|
)
|
||||||
|
1
main.go
1
main.go
@ -2,7 +2,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitea.rebus.ninja/lore/wasm-nats-producer-client/gen/wasmcloud/messaging/handler"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
15
messaging.go
15
messaging.go
@ -6,6 +6,7 @@ import (
|
|||||||
"gitea.rebus.ninja/lore/wasm-nats-producer-client/gen/wasmcloud/messaging/types"
|
"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"
|
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"
|
//config "gitea.rebus.ninja/lore/wasm-nats-producer-client/gen/wasi/config/runtime"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type messagingConsumerAdapter struct {
|
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
|
// TODO implement the logic to get the destination topic from the config
|
||||||
// dest_topic := config.GetAll()
|
// dest_topic := config.GetAll()
|
||||||
dest_topic := "test.reply"
|
dest_topic := "test.reply"
|
||||||
|
counter := 0
|
||||||
|
|
||||||
// TASK
|
// TASK
|
||||||
for true {
|
for {
|
||||||
|
|
||||||
// generate random message
|
// generate random message
|
||||||
data := []byte("Hello, World!")
|
data := []byte("Hello, World! " + string(counter))
|
||||||
|
|
||||||
// Send reply
|
// Send reply
|
||||||
reply := types.BrokerMessage{
|
reply := types.BrokerMessage{
|
||||||
@ -41,6 +43,15 @@ func loop() cm.Result[string, struct{}, string] {
|
|||||||
return res
|
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{}{})
|
return cm.OK[cm.Result[string, struct{}, string]](struct{}{})
|
||||||
|
Loading…
Reference in New Issue
Block a user