-
Notifications
You must be signed in to change notification settings - Fork 136
ReactiveStreams : SeqSubscriber
johnmcclean-aol edited this page Nov 23, 2016
·
1 revision
SeqSubscriber is a ReactiveStreams subscriber that will subscribe to a ReactiveStreams Publisher and extract sequences e.g.
SeqSubscriber<Integer> ints = SeqSubscriber.subscriber();
ReactiveSeq.of(1,2,3)
.publish(ints);
ListX<Integer> list = ints.toListX();
ReactiveSeq<Integer> seq = ints.toStream();
Errors and events are propagated from upstream pipelines to downstream ones e.g.
SeqSubscriber<Integer> sub = SeqSubscriber.subscriber();
ReactiveSeq.of(1,2,3)
.peek(i->{throw new RuntimeException("boo!");})
.subscribe(sub);
sub.stream()
.forEachWithError(System.out::println, System.err::println);
oops - my bad