Multiple Direct Subscribers

A program can create more than one direct subscriber on an endpoint. Each direct subscriber object receives every buffer published on the bus.

  • You can use multiple direct subscribers to process the same inbound data stream with different callback semantics.
  • You cannot use multiple direct subscribers to increase throughput by dividing an inbound data stream.
Tip: In multithreaded application programs, use a separate direct subscriber object and a separate dispatch loop in each thread.

For best results, if an application program uses more than one direct subscriber object, create them all before starting the any of their dispatch loops.

Tip:

Programs may use a direct subscriber in multiple threads. However, contention to dispatch a direct subscriber object can decrease performance and increase latency.

Create only a finite number of direct subscriber objects. Re-use them as needed. Close them only when cleaning up to prepare for the process to exit.