Added example code for pub sub