Added example using the pub-sub pattern.