-
-
Notifications
You must be signed in to change notification settings - Fork 11
5_core_io_integration
@page core_io_integration_readme_md QB Framework: Integrating Core Actors with Asynchronous I/O
@brief Understand how qb-core
actors seamlessly leverage qb-io
for non-blocking network operations, timers, and file handling.
The QB Actor Framework achieves its power and efficiency through the tight and seamless integration of its two primary components: the qb-core
actor engine and the qb-io
asynchronous I/O library. While qb-io
can function as a standalone library, its design is pivotal to how actors in qb-core
interact with the outside world (networks, file systems) and manage time-based events without blocking.
This section explores how these two modules work in concert, enabling you to build truly concurrent and responsive applications.
-
Shared Event Loop: The key integration point is the event loop (
qb::io::async::listener
). Eachqb::VirtualCore
(the execution context for actors) runs its ownlistener
. This single loop per core manages both actor events and I/O events. -
Non-Blocking Actors: When an actor performs an I/O operation using
qb-io
(e.g., network reads/writes), the operation is initiated non-blockingly. Thelistener
notifies the actor when the operation completes or data is ready, typically by invoking anon(...)
handler. -
Unified Scheduling: Timers and delayed tasks scheduled via
qb::io::async::callback
orqb::io::async::with_timeout
are handled by the samelistener
that dispatches actor events.
-
Asynchronous Operations within Actors
- Learn how actors can use
qb::io::async::callback
for timers and deferred tasks, andqb::io::async::with_timeout
for managing inactivity or operational timeouts. Also covers strategies for handling blocking file I/O from actors asynchronously.
- Learn how actors can use
-
Building Network-Enabled Actors
- Discover how to make your actors network clients or servers using the
qb::io::use<>
helper template, integrating TCP, UDP, and SSL/TLS capabilities directly into actor logic.
- Discover how to make your actors network clients or servers using the
-
Case Studies: Example Analyses
- Explore detailed walkthroughs of complex examples (
chat_tcp
,distributed_computing
,file_monitor
,file_processor
,message_broker
) to see howqb-core
andqb-io
are used together to build substantial applications.
- Explore detailed walkthroughs of complex examples (
Understanding this integration is key to unlocking the full potential of the QB Actor Framework, enabling you to build applications that are not only concurrently sound but also exceptionally performant and responsive to external events and I/O demands.
(Next: Dive into Integrating Core & IO: Async Operations in Actors or Integrating Core & IO: Network Actors for more specific details.**)