2024-12-14 00:26:30 +00:00
|
|
|
apiVersion: core.oam.dev/v1beta1
|
|
|
|
kind: Application
|
|
|
|
metadata:
|
|
|
|
name: tinygo-hello-world
|
|
|
|
annotations:
|
|
|
|
description: 'HTTP hello world demo in Golang (TinyGo), using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)'
|
|
|
|
wasmcloud.dev/authors: wasmCloud team
|
|
|
|
wasmcloud.dev/source-url: https://github.com/wasmCloud/wasmCloud/blob/main/examples/golang/components/http-hello-world/wadm.yaml
|
|
|
|
wasmcloud.dev/readme-md-url: https://github.com/wasmCloud/wasmCloud/blob/main/examples/golang/components/http-hello-world/README.md
|
|
|
|
wasmcloud.dev/homepage: https://github.com/wasmCloud/wasmCloud/tree/main/examples/golang/components/http-hello-world
|
|
|
|
wasmcloud.dev/categories: |
|
|
|
|
http,outgoing-http,http-server,tinygo,golang,example
|
|
|
|
spec:
|
|
|
|
components:
|
|
|
|
- name: echo
|
|
|
|
type: component
|
|
|
|
properties:
|
|
|
|
# To use the locally compiled code in this folder, use the line below instead after running `wash build`:
|
|
|
|
image: file://./build/go_nats_client_s.wasm
|
|
|
|
# image: gitea.rebus.ninja/lore/go-nats-client:1.0.1
|
|
|
|
id: echo
|
|
|
|
traits:
|
|
|
|
# Govern the spread/scheduling of the component
|
|
|
|
- type: spreadscaler
|
|
|
|
properties:
|
|
|
|
instances: 1
|
|
|
|
# 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: echo
|
|
|
|
namespace: wasmcloud
|
|
|
|
package: messaging
|
|
|
|
interfaces: [handler]
|
|
|
|
source_config:
|
|
|
|
- name: simple-subscription
|
|
|
|
properties:
|
|
|
|
subscriptions: wasmcloud.echo
|