The variety and volume of data produced by devices and sensors in Intelligent Environments (IEs) pose difficulties regarding their collection, analysis and delivery. More specifically, extraction of high level information valuable for the users requires specialized analysis techniques. In this study, we present a framework incorporating complex event processing (CEP) and publish-subscribe based messaging for addressing such needs. Within the framework, data are collected from heterogeneous data sources to go through CEP based analysis, and then the results are delivered to interested recipients. The components of the framework are loosely-coupled through the use of event driven architecture (EDA) in the form of a publish-subscribe messaging system. This enables the use of different CEP engines without requiring the modification of other components in the framework. Similarly, new data sources and delivery end-points can be as easily integrated into the framework. A real life prototype implementation is also provided for validation. The prototype includes various event producers such as electret microphone, light, temperature, motion, magnetic, optical sensors, RFID (Radio Frequency Identification) readers, smart phones, and other software systems, which are deployed in a classroom setting. End users receive relevant raw data and high level information according to their preferences, through the use of web and mobile applications. The results suggest the applicability of the framework for IEs. The prototype implementation in the classroom shows that using different event producers helps improve the analysis results and CEP is an appropriate method for data analysis in IEs.