We actually use RxJS in parts of the system. We needed to encapsulate what a stream consists of, for this part RxJS didn't give any handles to improve type-safety. If you do know of anything that could supply similar guarantees I'd love to hear it.

That's a nice approach too. For us it was very important to ensure every type is handled. Also the many streams had very specialised handlers per message type. By having this object (+types) we could ensure both. The handlers remained simple, which is important for the project because the project itself was already quite big. So it allowed us to have one simple handler per type instead of one big handler. Having one handler with an if or switch construction also made it possible for developers to forget handling certain data, which is what we wanted to prevent.

​

We created a projection mechanism, of which this was a centre-piece. All that came after is, the subscriptions to the resulting streams, were all done using RxJS though.