[ETCM-1053] extend PeerEventBus to support Akka Streams #1087
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
... and use it for the Peer case class as specified in the ticket.
However, I'm a bit skeptical we want to go down the route of managing and materializing a separate source per actor. Instead I think it will be more practical to use one source with the messages from different peers. That way we won't need to worry about setup and teardown and precise synchronisation of these things. Look at the added spec for an example of this (there's a
Thread.sleep
in there.)A possible improvement would be to materialize a future that completes when the subscription is performed (via ask-pattern with the
PeerEventBusActor
) to aid in this synchronisation. I was playing around with this but it only made sense for the specs, and I think we should avoid this kind of stuff for production code.There's also a small bugfix in there to unsubscribe when the subscribing actor dies, which might cause memory leaks otherwise.