An event demultiplexer for QuantumRunStreamResponses, as part of the async reactor pattern.

A caller can subscribe to the response matching a provided message ID. Only a single caller may subscribe to each ID.

Another caller can subsequently publish a response. The future held by the subscriber with the matching message ID will then be fulfilled.

A caller can also publish an exception to all subscribers.



View source

Makes the response available to the subscriber with the matching message ID.

The subscriber is unsubscribed afterwards.

If there are no subscribers waiting for the response, nothing happens.


View source

Publishes an exception to all outstanding futures.


View source

Subscribes to the QuantumRunStreamResponse with a matching ID.

There should only be one subscriber per message ID.

A future for the response, to be fulfilled when publish is called.

ValueError when trying to subscribe to a message_id which already has a subscriber.