I came up with a means of executing code dynamically across Gemfire servers and regions. The idea was motivated by wanting to retain the separation of concerns between an application's logic layer and its data layer (Gemfire). I felt that the logic layer should be able to deliver code to execute to the data layer, rather than the data layer have to be distributed (built) with that logic layer code.
The above returns the followers of a user referenced by the variable handle. The GetFollowers.js file is defined as:
The only problem I've ran into so far is that I do not appear to be able to execute a function in the context of a transaction. I get a com.gemstone.gemfire.InternalGemFireError: dm not in initMembers.