The convergence of the Internet, sensor networks, and Radio Frequency Identification (RFID) systems has ushered to the concept of Internet of Things (IoT) which is capable of connecting daily things, making them smart through sensing, reasoning, and cooperating with other things. Further, RFID technology enables tracking of an object and assigning it a unique ID. IoT has the potential for a wide range of applications relating to healthcare, environment, transportation, cities… Moreover, the middleware is a basic component in the IoT architecture. It handles heterogeneity issues among IoT devices and provides a common framework for communication. More recently, the interest has focusing on developing publish/subscribe middleware systems for the IoT to allow asynchronous communication between the IoT devices. The scope of our paper is to study routing protocols for publish/subscribe schemes that include content and context-based routing. We propose an Energy-Efficient Content-Based Routing (EECBR) protocol for the IoT that minimizes the energy consumption. The proposed algorithm makes use of a virtual topology that is constructed in a centralized manner and then routes the events from the publishers to the intended interested subscribers in a distributed manner. EECBR has been simulated using Omnet++. The simulation results show that EECBR has a significant performance in term of the energy variance compared to the other schemes.