Created
February 13, 2015 15:18
-
-
Save nelanka/32a0a82e6d30a2869d8b to your computer and use it in GitHub Desktop.
Scala RX Snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add rx things together and log stuff: | |
(consumer.stream1 ++ consumer.stream2 ++ consumer.stream3).subscribe(event => logger.info("Received event " + event)) | |
Filter out messages: | |
consumer.stream1.filter(_.isEnabled != true).subscribe(event => map.remove(event.id)) | |
It’s kinda handy that rx streams are basically infinite lists that you can apply all scala magical collection incantations to. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment