Description
I am kind of struggling to translate the Intro to Rx article into something that will help me use RxCpp. I am not looking for examples that parallel the ranges examples, but rather on how to construct my own observable
s, oberserver
s, and (more likely) subject
s.
As background: I have a library that will need to process an asynchronous data stream, where the underlying API is a given. No API call is synchronous. Any response, error or reply, comes in through a message stream and is handed off to a callback that I can register with the API. The callback has to check what kind of message it has followed by message-specific attempts to match the message to a previous request. What appears to work well in C# using the .Net version of Rx, is registering collections of Subjects for each kind of message. Then the message dispatcher can just look up the collection of subscribers and call OnNext
, OnError
, or OnCompleted
as needed. The user of my library can perform any request needed, receiving an Observable
that it can subscribe to, or if the reply is known to be a single message, do a blocking Get()
.
I would have expected to be able to use the same approach in C++, but cannot find any hints on how to use RxCpp in this manner. The namespace structure does not match the packages in C# or Java and many of the classes from those implementations I cannot find. The online Doxygen documentation for most RxCpp classes looks pretty empty.