Message envelope
The message is theServiceMessage described in Protocol:
The target receives a
ServiceMessageReply:
The Kernel does not interpret
topic, payload, or message. Define their
format between the participating services. You can use JSON, a generated
message type, text, or another encoding, but the sender and target must
agree on it.
Send a message
To send a message:- choose the registered name of the target service;
- choose a stable topic name;
- encode the request into
payload; and - send the envelope through the generated host binding for your runtime.
message value.
The source service cannot choose or override its identity; the Kernel
replaces the source field with the authenticated name of the calling
service.
Receive a message
The target service receives the same envelope, including the Kernel-providedsource. It should:
- verify that the source service is allowed to request the operation;
- route the message by
topic; - decode and validate
payload; and - return either a result or an error.
wasm and grpc
services can receive messages this way — a static service has no handler
to dispatch to.
Errors and delivery
Messages are delivered only to a currently running target service. The send fails when:targetis empty;- the target service is not running;
- the target handler returns a transport or execution error; or
- the target reply contains a non-empty
errorfield.
error value is returned to the sender as an error. A message is
not delivered to another service when the target is unavailable.
Messages are not queued, retried, broadcast, or persisted. There is no
durable delivery guarantee. If the target stops while a message is in flight,
the call context is canceled with the target service’s lifecycle.
Backend behavior
The message semantics are identical for both service runtimes:- a WASM service sends through generated host bindings; and
- a gRPC service sends through the Kernel’s host callback channel.
Identity and authorization
The Kernel authenticates the source service at the host boundary. A service cannot impersonate another service by writing a differentsource value into
a send request.
There is no Kernel-level access policy for individual topics. Any running
service can address another running service by name, so the target must
enforce authorization in its own handler when a topic or payload represents a
privileged operation. Treat topic as routing information, not as an access
control mechanism.