Intersession Layer Messaging (ISM)
A reliable messaging system that provides guaranteed message delivery and ordering across network sessions, with automatic recovery of pending messages when peers reconnect. ISM can be considered a "metasession" layer that sits on top of your existing network transport, ensuring that messages are reliably delivered and processed in the correct order even if the underlying transport is unreliable or unordered.
Why do you need ISM if transports like TCP/QUIC are already reliable/ordered? While these transports are reliable and ordered within a single session, they do not provide guarantees across sessions. If a peer disconnects and reconnects, messages sent before the disconnection may be lost or delivered out of order. ISM solves this problem by persisting messages until they are successfully delivered and acknowledged, and by enforcing strict ordering of messages between peers.
Features
- Guaranteed Message Delivery: Messages are persisted until successfully delivered and acknowledged
- Message Ordering: Strict ordering of messages between peers
- Concurrent Processing: Efficiently handles multiple peer connections simultaneously
- Graceful Shutdown: Clean shutdown with delivery of pending messages
- Flexible Backend: Pluggable backend storage system
- Custom Network Layer: Adaptable to different network implementations
- Intersession Recovery: Automatically recovers pending inbound/outbound messages when peers reconnect
- Head of Line Blocking: Ensures stability for applications that require strict message ordering
Usage
ISM is designed to be flexible and easy to integrate into your existing network system. It provides a simple API for sending and receiving messages, and can be customized to work with your own network and storage systems.
Below is an example of using the TestMessage
type, which already implements MessageMetadata
Basic Example
use ;
use async_trait;
async