You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
johnmcclean-aol edited this page Feb 23, 2015
·
3 revisions
Signals
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));