TERA: Topic-based event routing for peer-to-peer architectures