#actor #wasmcloud #health-check #api-bindings

wasmcloud-actor-core

wasmCloud Core Actor Interface

4 releases

0.2.3 Apr 16, 2021
0.2.2 Feb 22, 2021
0.2.1 Feb 16, 2021
0.2.0 Feb 10, 2021

#1585 in WebAssembly

Download history 225/week @ 2024-08-26 188/week @ 2024-09-02 284/week @ 2024-09-09 275/week @ 2024-09-16 334/week @ 2024-09-23 40/week @ 2024-09-30 3/week @ 2024-10-07 22/week @ 2024-10-14 44/week @ 2024-10-21 24/week @ 2024-10-28 24/week @ 2024-11-04 23/week @ 2024-11-11 32/week @ 2024-11-18 48/week @ 2024-11-25 78/week @ 2024-12-02 63/week @ 2024-12-09

222 downloads per month
Used in 23 crates (22 directly)

Apache-2.0

10KB
91 lines

crates.io  Rust license  documentation

wasmcloud Core Actor Interface

All actors must respond to the core HealthCheckRequest message with either an Err or a HealthCheckResponse. The following is an example of what an actor looks like that only responds to the health check message:

extern crate wasmcloud_actor_core as actor;
use wapc_guest::HandlerResult;
use actor::{HealthCheckRequest, HealthCheckResponse, Handlers};

 #[actor::init]
 fn init() {
     Handlers::register_health_request(health);
 }

 fn health(_msg: HealthCheckRequest) -> HandlerResult<HealthCheckResponse> {
     Ok(HealthCheckResponse::healthy())
 }

The actor::init macro defines a health check message responder that always returns healthy() by default. If you don't need to provide your own custom logic for the health check, then your init function can be simplified as follows:

extern crate wasmcloud_actor_core as actor;
use wapc_guest::HandlerResult;

#[actor::init]
fn init() {
    // register your message handlers here
}

Dependencies

~1.1–2.2MB
~45K SLoC