Does the spin host support multiple wasm guests (which call each other)? #1686
-
IOW is it possible to have a spin http serverless wasm call a function in a sibling wasm file (in my case it would be bundled up into a single docker image)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @GordonSmith, as of today, the only stable/supported method of invoking logic in a sibling wasm file (component) is via an http api endpoint and the use of outbound http calls. For example, consider an app consisting of sibling A as a web frontend and sibling B as a backend handling database logic. Sibling A could make a request to store state via an outbound HTTP request to the app endpoint that sibling B has a handler for. (This requires the sibling A component to know the app's hostname or address:port combination. There is an issue for improving this experience: #957) Assuming the question is more about executing functions directly between sibling wasm files (doing away with the need for http calls), work here is still experimental and evolving (as the upstream component model evolves), but there are some examples out there showing use with Spin. A recent one is https://github.com/tschneidereit/calculator-demo. In addition, https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-compose/example is a good example of generic component composition approach that I believe can technically run in Spin when wrapped up into a composed wasm module (https://github.com/fibonacci1729/spin-compose-example does this, but may need updating). However, support in Spin would most likely remain unstable until a 2.0 release. |
Beta Was this translation helpful? Give feedback.
Hi @GordonSmith, as of today, the only stable/supported method of invoking logic in a sibling wasm file (component) is via an http api endpoint and the use of outbound http calls. For example, consider an app consisting of sibling A as a web frontend and sibling B as a backend handling database logic. Sibling A could make a request to store state via an outbound HTTP request to the app endpoint that sibling B has a handler for. (This requires the sibling A component to know the app's hostname or address:port combination. There is an issue for improving this experience: #957)
Assuming the question is more about executing functions directly between sibling wasm files (doing away with the ne…