Simple partitioned example help
Hi, I think this should be pretty simple. I.e., a service that listens on a routed request-event, and writes a result based on it. The driver write()'s a request and take()'s the result before writing the next request.
The request routing-key is an integer so I generate a bunch of requests, incrementing the routing-key so that I exercise each partition. I get the first result, but fail to receive any more. Any ideas what I'm doing wrong?
public class Request { @SpaceId @SpaceRouting public int requestId() {} // etc. }
public class MyService { @SpaceDataEvent public void myEventHandler(Request req, GigaSpace space) { space.write(new Result(req)); // generate the result from the request-info } //etc }
Configured thus:
<os-core:space id="jspace" url="/./TestSpace"/>
<os-core:giga-space id="gigaSpace" space="jspace" />
<bean id="service" class="kov.test.MyService" />
<os-events:polling-container id="routingEventContainer" giga-space="gigaSpace">
<os-core:template><bean class="kov.test.common.Request" /></os-core:template>
<os-events:listener>
<os-events:annotation-adapter><os-events:delegate ref="service"/></os-events:annotation-adapter>
</os-events:listener>
</os-events:polling-container>
And driven like this:
GigaSpace space = new GigaSpaceConfigurer(
(IJSpace) SpaceFinder.find("jini://*/*/TestSpace?groups=kov")).gigaSpace();
Result result = null;
for(int i = 0; i < ITERATIONS; ++i) {
space.write(new Request(i));
Result result = space.take(new Result());
assertNotNull(result);
}
{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=2383]{quote}