Conceptual Introduction
The direct Publisher and Subscriber APIs give you low-level control over messaging in Cerulion Core. Unlike TopicManager, which handles discovery, session management, and transport selection automatically, these APIs require you to manage these aspects manually.Manual Control
Fine-grained control over network enable/disable, session management, and transport selection
Raw Bytes
Work directly with raw bytes - you handle serialization/deserialization yourself
Direct Access
Direct access to iceoryx2 listeners and low-level transport mechanisms
Custom Sessions
Create and manage your own Zenoh sessions and iceoryx2 nodes
When to use direct Publisher/Subscriber:
- You need runtime control over network enable/disable per publisher
- You want to manage your own Zenoh sessions and iceoryx2 nodes
- You need direct access to iceoryx2 listeners for event-based programming
- You’re building a custom abstraction layer on top of Cerulion Core
- You need to share sessions across multiple independent components
- You want automatic discovery and transport selection (recommended for most use cases)
- You want shared session management to reduce resource overhead
- You want centralized management of multiple topics
- You prefer working with typed messages rather than raw bytes
Key Behaviors and Guarantees
receive()never blocks - Always returns immediately withOk(Some(bytes)),Ok(None), orErr(e)- Messages are raw bytes - You must handle serialization and deserialization yourself
- Local transport is always available - Publishers always use iceoryx2 for local communication
- Network transport is optional - Can be enabled/disabled at runtime per publisher
- Latest-message semantics for network - If network is slow, only the most recent message is sent
- Manual session management - You create and manage Zenoh sessions and iceoryx2 nodes
Comparison with TopicManager
| Feature | Direct Publisher/Subscriber | TopicManager |
|---|---|---|
| Discovery | Manual | Automatic |
| Session Management | Manual (per pub/sub) | Shared (centralized) |
| Transport Selection | Manual | Automatic |
| Type Safety | Runtime (deserialization) | Compile-time + Runtime |
| Message Format | Raw bytes | Typed messages |
| Network Control | Per-publisher enable/disable | Automatic on discovery |
| Resource Usage | Higher (multiple sessions) | Lower (shared session) |
| Complexity | Higher | Lower |
Next Steps
Quickstart
Get started with a complete working example
API Reference
Browse the complete API documentation
Transport Modes
Understand transport selection and control
Best Practices
Learn recommended usage patterns
Error Handling
Common errors and troubleshooting
TopicManager
Use the preferred automatic management approach