In this paper, we propose a novel dynamic data flow platform for Internet of Things (IoT) applications in edge computing environments. To avoid the overloads on network and computational resources that are caused by IoT applications, the proposed platform replicates processes and changes the structure of the data flow dynamically on the distributed computational resources located at network edges and data centers. The proposed platform adds the notion of "index" to the existing distributed topic-based pub/sub (TBPS) messaging method to support flexible data flow definitions and process allocations. In addition, we propose a peer-to-peer-based data stream routing algorithm called "Locality-Aware Stream Routing (LASR)" which can change the data stream destination dynamically on extended TBPS in accordance with structural changes of a data flow, considering network communication localities. By simulation, we confirm that our proposed platform using LASR can change the data stream destination quicker than existing methods with a small overhead in an edge computing environment, even when running applications involving video analysis data flow with a high data rate.