The Internet of Things fosters an emerging class of analytics that connects sensors, vehicles, industries, and consumers through the internet to enable scientific and industrial applications. These services require a large computing capacity to perform well, while often being under the constraints to move data from the edge of the network to the cloud. Also, they require system support to program reactions that occur at runtime, especially when the target infrastructure capacities and capabilities are unknown during the design. The core of this survey is a comprehensive review of existing components for Edge Computing and Internet of Things applications. In recent years, the landscape of the edge middleware platforms has grown exponentially with more than a hundred available solutions in academia and industry. Such platforms are required to provide necessary components for sensor registration, resource discovery, workflow composition, and data processing. In this regard, we surveyed existing solutions through the lens of a simplified three-layer architecture for the design of edge-based middleware, along with design goals for each of the proposed layers. The paper concludes with some open challenges and possible future research directions.