wasmcloud-actor-core

Crates.iowasmcloud-actor-core
lib.rswasmcloud-actor-core
version0.2.3
sourcesrc
created_at2021-02-10 13:42:53.076393
updated_at2021-04-16 15:53:14.047289
descriptionwasmCloud Core Actor Interface
homepage
repository
max_upload_size
id353229
size10,174
wasmCloud Automation Bot (wasmcloud-automation)

documentation

https://docs.rs/wasmcloud-actor-core

README

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
}
Commit count: 0

cargo fmt