Most of currently available content-based publish-subscribe systems that were designed to operate in large scale, wired scenarios, build their routing infrastructure as a set of brokers connected in an acyclic network. The topology of such network is critical for the performance of the system. Depending on the traffic profile, the same topology may provide good performance or be very inefficient. Starting from this consideration, in this paper we first analyze this issue in detail, then we describe a distributed algorithm to address it, by adapting the topology of a content-based publish-subscribe routing network to the application demand. Categories and Subject Descriptors C.2.4 [Computer Communication Networks]: Distributed Systems General Terms Algorithms, Performance Keywords Optimization, publish-subscribe Systems, Content-Based Routing, Adaptive Routing, Autonomic Computing