Microservices
Redis
The Redis link, Pub/Sub per pattern with the whole frame as the message.
The Redis link subscribes to a Pub/Sub channel per pattern. Every message is one whole frame in the link's codec, and replies arrive on a per-client reply channel.
app.bind(ulo_rpc::Server::new(ulo_rpc_redis::Redis::url("redis://cache:6379")));Settings
| Method | Effect |
|---|---|
Redis::url(url) | redis://, or rediss:// under the crate's tls feature |
codec(Codec) | JSON by default; Codec::Cbor carries raw bytes |
with_handle(Handle) | the tokio runtime, when the link is built outside one |
ulo-rpc-redis = { version = "=0.1.0-alpha.3", features = ["tls"] }One server instance for requests
Pub/Sub has no competing mode. Every server instance subscribed to a pattern runs the handler for a request published to it, and the client keeps the first reply and drops the rest. The link declares that it does not deliver once, and a server mounting request handlers or events left at the default on it logs a warning. Run one server instance per such pattern. An event declared #[ulo_rpc::event("pattern", every_instance)] reaches every subscribed instance, as Pub/Sub does.
Behaviour
- Misses. A
PUBLISHwith a receiver count of zero is mapped tounavailablewith the reasonno_destination. - Lost connection. A call waiting when the client's Pub/Sub connection drops fails
Unavailable. - Delivery. At most once, ordered per channel. No frame limit is declared. A frame is bounded by what Redis accepts.
- Wire. A
reqoropenframe carries the caller's reply channel in its headers asulo-reply, which the server removes before a handler reads them.in,in_endandcanceltravel onulo:rpc:control, which every server subscribes to. A caller's frame ids start at a random offset so two callers never name the same call. - Drain. The server unsubscribes and waits for Redis's reply.