apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: go-data-producer
  annotations:
    description: 'Data producer 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-producer-client.git/wadm.yaml
    wasmcloud.dev/readme-md-url: https://gitea.rebus.ninja/lore/wasm-nats-producer-client.git/README.md
    wasmcloud.dev/homepage: https://gitea.rebus.ninja/lore/wasm-nats-producer-client.git
    wasmcloud.dev/categories: |
      data-producer,nats-client,tinygo,golang
spec:
  components:
    - name: go_data_producer
      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-producer-client:1.0.4
        id: producer
        # config: 
        #   - name: nats-topic
        #     properties: 
        #       dest-topic: wasmcloud.echo.reply
      traits:
        # Govern the spread/scheduling of the component
        - type: spreadscaler
          properties:
            instances: 1
        - type: link
          properties:
            target: nats-producer
            namespace: wasmcloud
            package: messaging
            interfaces: [consumer]

    # Add a capability provider that implements `wasmcloud:messaging` using NATS
    - name: nats-producer
      type: capability
      properties:
        image: ghcr.io/wasmcloud/messaging-nats:0.23.1
      traits:
        - type: spreadscaler
          properties:
            instances: 1