Added event publish/listener code.

This code applies has examples for commands.