Hi there Amit,
Yes, a merry christmas to you as well.
The compute task that you need to complete, is there a dependency
between the regions that need to kept within the computation? i.e read
data from RegionA, look it up on RegionB and then calculate the result
using Region C? The difficult piece to this puzzle is to make sure you
travel over the network boundary as little as possible. (for performance
reasons). Also, are you using Replicate or Partitioned regions. Maybe an
simple example of what you intending to do, would help us to help you
with this.
In many cases a good way to do this would be to write a function that
would act on the local data on each server. Then you invoke the function
with "onRegion" to make sure you get a RegionFunctionContext.
When a function has completed and you need to send back the result, use
the ResultSender that is on the context and use "sendResult". Remember
to use "sendLastResult" when there is no more data that is to be sent
from the server. The invoking client's "getResult" will then return you
the result of all the server nodes. You can then iterate over the
results on the client to build up your final result view. You can also
look at how to write your own ResultCollector on the client. Then you
could do some custom work as the data is received from the servers.
In addition you can use "sendException" if you need to send back a
processing exception back from the server. Be aware that if you use
"sendException" it will behave like "sendLastResult" and will not expect
any more data at that point.
--Udo
On 12/24/16 11:43, Amit Pandey wrote:
Hi Guys,
Merry Christmas .
I have three regions. I want to do some compute tasks at a go on all
three combined. I also have three nodes. How should I write a Geode
function so that I can distribute the load in between the different
nodes and also read data locally (means send the code where the data is).
After the execution is over I need to send the result to the caller.
Whats the best way to achieve this?
Regards