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:
```rust extern crate wasmcloudactorcore as actor; use wapc_guest::HandlerResult; use actor::{HealthCheckRequest, HealthCheckResponse, Handlers};
#[actor::init] fn init() { Handlers::registerhealthrequest(health); }
fn health(_msg: HealthCheckRequest) -> HandlerResult
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:
```rust extern crate wasmcloudactorcore as actor; use wapc_guest::HandlerResult;
fn init() { // register your message handlers here } ```