-
Notifications
You must be signed in to change notification settings - Fork 134
Signals Explained
johnmcclean-aol edited this page Feb 16, 2015
·
3 revisions
Signals provide a way to access the changes within a stream e.g.
Stream.of(1,1,1,1,1,1,1,1,1,1,2)
Should result in a Stream
Stream.of(1,2)

A Signal can be backed by either a Queue or a Topic (and the rules as to whether all messages will be seen by Processing Stream A or B will depend on which is used).
Signal signal = Signal.queueBackedSignal();
//thread 1 : populate signal with health data signal.fromStream(Stream.generate(()->checkHealthStatus()) .peek(status -> sleep(500));
//thread 2 : read changes in health from Signal signal.stream().forEach(health -> respond(health));
oops - my bad