base for pub / sub
Extracted base pub / sub from existing code