pub trait WasmQueueInvoker: Send + Sync {
// Required methods
fn invoke<'a>(
&'a self,
app_id: &'a str,
name: &'a str,
payload: &'a [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>> + Send + 'a>>;
fn knows_app(&self, app_id: &str) -> bool;
}Expand description
Process-wide hook for routing queue jobs into wasm components.
yeti-queue’s dispatcher (in crates/runtime/yeti-queue) checks
the static inventory-built native registry first via
lookup_queue_fn_for_app. When that lookup misses AND a wasm
invoker is installed via set_wasm_queue_invoker, the
dispatcher routes through here: the invoker is expected to find
the wasm component for app_id, call its invoke-queue-fn
export with (name, payload), and return either the
msgpack-encoded result or an error message.
Layered this way (OnceLock<Arc<dyn ...>> in yeti-types, impl
installed from yeti-server at startup) to avoid pulling
yeti-wasm-host into yeti-queue’s dep tree.
Required Methods§
Sourcefn invoke<'a>(
&'a self,
app_id: &'a str,
name: &'a str,
payload: &'a [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>> + Send + 'a>>
fn invoke<'a>( &'a self, app_id: &'a str, name: &'a str, payload: &'a [u8], ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>> + Send + 'a>>
Invoke a queue_fn on a wasm component.
app_id identifies the owning app; name the function;
payload is the msgpack-encoded arg tuple. The implementor
looks up the live wasm component, calls its
invoke-queue-fn export, and returns the bytes the
component handed back (typically a msgpack-encoded
serde_json::Value).
Returns Err(msg) if the app isn’t a wasm app, the function
isn’t registered, or the wasm invocation traps / errors.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".