1. A wireless sensor network comprising: a plurality of nodes that communicate over wireless communication links, wherein at least one of the plurality of nodes receives sensor data from a sensor; wherein a first node in the plurality of nodes is operable to generate at least one subscription for an event of interest occurring in the wireless sensor network from a query received at the wireless sensor network, the at least one subscription being generated in an executable form; wherein the executable form of the subscription is communicated from the first node to a publisher node included in the plurality of nodes, wherein the publisher node is connected to the sensor; and wherein a virtual machine executing on the publisher node executes the executable form of the subscription to determine when the event of interest occurs based on sensor data output from the sensor and to publish data related to the event of interest for a subscriber node included in the plurality of nodes when the event of interest occurs and in response to the event occurring.