wasm-nats-stream-client/wadm.yaml
2024-12-17 11:58:01 +01:00

91 lines
3.7 KiB
YAML

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