Microgrids are moving towards large-scale smart distributed networks which demand an efficient and reliable communication infrastructure to manage, control and monitor energy resources. With regard to this, publisher/subscriber event-based middleware has become relevant for large-scale distributed time applications because it allows decouple time and space between senders and receivers. Particularly the content publish/subscribe systems over structured peer-to-peer (P2P) networks has emerged to enhance scalability and dynamism of notification middleware systems. However, this type of systems use multicast routing schemes that still generate much network traffic and as a consequence an overload of the communication channel is produced. This results in inefficient network utilization and rapid depletion of network resources leading to unreliable operations, degradation of system performance and even instability of the microgrid. In this paper, a new contentbased publish/subscribe notification middleware over structured P2P systems is proposed, such that smart microgrid communication requirements are met. This proposed system organizes the publications and subscriptions in a one dimensional representation using the Hilbert space filling curve. Through this representation, an innovative routing and matching algorithms are developed. Experimental results demonstrate that the proposed publisher/subscribe system significantly enhance efficiency of the system, network performance and the use of computational resources.