changed names

This commit is contained in:
Lorenzo Venerandi 2024-12-17 11:58:01 +01:00
parent 81fd140346
commit 072726dd06
2 changed files with 91 additions and 91 deletions

View File

@ -23,7 +23,7 @@ func handleMessage(msg types.BrokerMessage) cm.Result[string, struct{}, string]
// TODO implement the logic to get the destination topic from the config
// dest_topic := config.GetAll()
dest_topic := msg.Subject + ".reply"
dest_topic := "finish"
// TASK

180
wadm.yaml
View File

@ -1,91 +1,91 @@
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: go-data-stream
annotations:
description: 'Data stream processing using NATS topic in Golang (TinyGo), using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)'
wasmcloud.dev/authors: Lorenzo Venerandi
wasmcloud.dev/source-url: https://gitea.rebus.ninja/lore/wasm-nats-stream-client.git/wadm.yaml
wasmcloud.dev/readme-md-url: https://gitea.rebus.ninja/lore/wasm-nats-stream-client.git/README.md
wasmcloud.dev/homepage: https://gitea.rebus.ninja/lore/wasm-nats-stream-client.git
wasmcloud.dev/categories: |
stream-processing,nats-client,tinygo,golang
spec:
components:
- name: go-data-stream
type: component
properties:
# To use the locally compiled code in this folder, use the line below instead after running `wash build`:
# image: file://./build/echo_messaging_s.wasm
image: gitea.rebus.ninja/lore/wasm-nats-stream-client:1.0.1
id: stream
config:
- name: nats-topic
properties:
dest-topic: wasmcloud.echo.reply
traits:
# Govern the spread/scheduling of the component
- type: spreadscaler
properties:
instances: 1
spread:
- name: cloud
weight: 100
requirements:
host-type: cloud
- name: edge
weight: 0
requirements:
host-type: edge
# Establish a unidirectional link to the messaging capability provider (powered by NATS),
# so the `echo` component can make use of messaging interface functionality
# (i.e. making interacting with the messaging system, in this case NATS)
- type: link
properties:
target: nats
namespace: wasmcloud
package: messaging
interfaces: [consumer]
# Add a capability provider that implements `wasmcloud:messaging` using NATS
- name: nats
type: capability
properties:
image: ghcr.io/wasmcloud/messaging-nats:0.23.1
## To configure OTEL integration for this provider specifically, uncomment the lines below
# config:
# - name: otel
# properties:
# otel_exporter_otlp_endpoint: "http://all-in-one:4318"
# otel_exporter_otlp_traces_endpoint: "http://traces-backend/v1/traces"
# otel_exporter_otlp_metrics_endpoint: "http://metrics-backend/v1/metrics"
# otel_exporter_otlp_logs_endpoint: "http://logs-backend/v1/logs"
traits:
# Since the `nats` capability provider calls an component to handle messages
# coming over subscriptions, this provider needs a unidirectional link to the
# component that wil be called.
#
# Here we link the `nats` provider (the "source"), to the `echo` component (the "target"),
# so that so the provider can deliver messages to the component (by invoking the wasmcloud:messaging/handler interface) .
- type: link
properties:
target: go-data-stream
namespace: wasmcloud
package: messaging
interfaces: [handler]
source_config:
- name: simple-subscription
properties:
subscriptions: streaming
- type: spreadscaler
properties:
instances: 1
spread:
- name: cloud
weight: 100
requirements:
host-type: cloud
- name: edge
weight: 0
requirements:
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: go-data-stream
annotations:
description: 'Data stream processing using NATS topic in Golang (TinyGo), using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)'
wasmcloud.dev/authors: Lorenzo Venerandi
wasmcloud.dev/source-url: https://gitea.rebus.ninja/lore/wasm-nats-stream-client.git/wadm.yaml
wasmcloud.dev/readme-md-url: https://gitea.rebus.ninja/lore/wasm-nats-stream-client.git/README.md
wasmcloud.dev/homepage: https://gitea.rebus.ninja/lore/wasm-nats-stream-client.git
wasmcloud.dev/categories: |
stream-processing,nats-client,tinygo,golang
spec:
components:
- name: go_stream_processor
type: component
properties:
# To use the locally compiled code in this folder, use the line below instead after running `wash build`:
# image: file://./build/echo_messaging_s.wasm
image: gitea.rebus.ninja/lore/wasm-nats-stream-client:1.0.3
id: stream
config:
- name: nats-topic
properties:
dest-topic: wasmcloud.echo.reply
traits:
# Govern the spread/scheduling of the component
- type: spreadscaler
properties:
instances: 1
spread:
- name: cloud
weight: 100
requirements:
host-type: cloud
- name: edge
weight: 0
requirements:
host-type: edge
# Establish a unidirectional link to the messaging capability provider (powered by NATS),
# so the `echo` component can make use of messaging interface functionality
# (i.e. making interacting with the messaging system, in this case NATS)
- type: link
properties:
target: nats
namespace: wasmcloud
package: messaging
interfaces: [consumer]
# Add a capability provider that implements `wasmcloud:messaging` using NATS
- name: nats
type: capability
properties:
image: ghcr.io/wasmcloud/messaging-nats:0.23.1
## To configure OTEL integration for this provider specifically, uncomment the lines below
# config:
# - name: otel
# properties:
# otel_exporter_otlp_endpoint: "http://all-in-one:4318"
# otel_exporter_otlp_traces_endpoint: "http://traces-backend/v1/traces"
# otel_exporter_otlp_metrics_endpoint: "http://metrics-backend/v1/metrics"
# otel_exporter_otlp_logs_endpoint: "http://logs-backend/v1/logs"
traits:
# Since the `nats` capability provider calls an component to handle messages
# coming over subscriptions, this provider needs a unidirectional link to the
# component that wil be called.
#
# Here we link the `nats` provider (the "source"), to the `echo` component (the "target"),
# so that so the provider can deliver messages to the component (by invoking the wasmcloud:messaging/handler interface) .
- type: link
properties:
target: go_stream_processor
namespace: wasmcloud
package: messaging
interfaces: [handler]
source_config:
- name: simple-subscription
properties:
subscriptions: streaming
- type: spreadscaler
properties:
instances: 1
spread:
- name: cloud
weight: 100
requirements:
host-type: cloud
- name: edge
weight: 0
requirements:
host-type: edge