This paper presents an approach, called LBS, for modelling and implementing the architecture of wireless sensor networks (WSNs) publish/subscribe (Pub/Sub) applications using a local broker subcomponent (LBS) model. Considering the reconfigurability of WSNs applications which is necessary for WSNs middleware, a graph-oriented local broker subcomponent (GOLBS) model is defined based on the LBS model by integrated WSNs middleware with Pub/Sub. Focusing on the evolution specification of reconfiguration and non-predefined dynamic reconfiguration, we define the notations of what is the GOLBS' graph grammars and GOLBS' graph, and show a derivative procedure. We design and implement a prototype system on GOLBS, called Pub/Sub-GOLBS. Performance evaluations imply that GOLBS can easily be constructed, while ensuring good reconfigurability.