xbbg-async is an asynchronous worker-pool engine built on top of xbbg-core designed to handle Bloomberg API requests and subscriptions.
To avoid contention and handle the fact that Bloomberg's Session is not Sync, the engine uses a thread-per-session model. Instead of sharing a single session via a Mutex, the architecture splits work into two distinct pools:
- RequestWorkerPool: Uses round-robin dispatch to send requests to worker threads. Each thread owns its own
Session and manages request lifecycles using one of 12 specialized state machines (e.g., RefData, HistData, Bql, IntradayBar). - SubscriptionSessionPool: A separate pool of sessions used specifically for managing subscriptions via sub-worker threads.
Additionally, the engine utilizes a SchemaCache (in-memory and disk-persisted) and a FieldCache (global and disk-persisted) to optimize service schema introspection and field type resolution.