Runtime linking dynamically connects separately running Wasm components during execution instead of combining them into one binary at build time. wasmCloud establishes and manages these links through wadm and NATS, using component-native wRPC so components can communicate across hosts. section 6.1
A runtime-linked wasmCloud application combines:
- A Wasm component that exports the HTTP incoming-handler interface. section 6.1
- An HTTP capability provider that invokes the component through a manifest-defined link. section 6.1
- A NATS lattice that carries communication whether components share a host or run on different hosts. section 6.1
Linking an HTTP component
Define an HTTP capability in wadm.yaml, target the http-component, select the wasi/http incoming-handler interface, and provide an address such as 127.0.0.1:8000. Start the environment with wash up -d, build with wash build, deploy with wash app deploy ./wadm.yaml, and verify with curl http://127.0.0.1:8000, which returns “Hello from Rust!”. section 6.1
Listing 6.4 wadm.yaml file (template comments/annotations hidden)
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: rust-hello-world
# ...
spec:
components:
- name: http-component
type: component
properties:
image: file://./build/http_hello_world_s.wasm
traits:
- type: spreadscaler #1
properties: #1
instances: 1 #1
- name: httpserver #2
type: capability #2
properties: #2
image: ghcr.io/wasmcloud/http-server:0.23.2 #2
traits:
- type: link #3
properties: #3
target: http-component #3
namespace: wasi #3
package: http #3
interfaces: [incoming-handler] #3
source_config: #3
- name: default-http
properties:
address: 127.0.0.1:8000
Inspect the wadm manifest that declares the component, capability provider, and runtime link. section 6.1
