The requirements of analyzing heterogeneous data streams and detecting complex patterns in near real-time have raised the prospect of complex event processing (CEP) for many Internet of Things (IoT) applications. Although CEP provides a scalable and distributed solution for analyzing complex data streams on the fly, it is designed for reactive applications as CEP acts on near real-time data and does not exploit historical data. In this regard, we propose a proactive architecture which exploits historical data using machine learning for prediction in conjunction with CEP. We propose an adaptive prediction algorithm called adaptive moving window regression for dynamic IoT data and evaluated it using a real-world use case with an accuracy of over 96%. It can perform accurate predictions in near real-time due to reduced complexity and can work along CEP in our architecture. We implemented our proposed architecture using open source components which are optimized for big data applications and validated it on a use-case from intelligent transportation systems. Our proposed architecture is reliable and can be used across different fields in order to predict complex events.