O'Reilly logo

From Java to C#: A Developer's Guide by Heng Ngee Mok

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

15.4. Another full example

This scenario involves three consumers and two events from the same event source. Two of the consumers will be listening to the same event, while the third consumer will be monitoring another event.

In this example, a WaterTank (the event source) fills up slowly. Two interested consumers, the EmergencyAlarm and the FlashingLight, want to be notified when the water level reaches 20 m so that they can start ringing and flashing to attract attention. The warnings are supposed to prompt the duty officer to rush over, pump out the water manually, and turn off the alarm and light. If he has had too much alcohol the night before and does not respond to the din, an Electrode (somehow attached to his body) should fire small ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required