Get results from write in JVM client?

Hi,

I'm currently using the JVM client, and do writes like so:

getEventStoreService.getConnection().tell( writeEvents, writeResult );

Where writeResult is the WriteResult class from the examples (minus
shutting it down). This works ok, but I would like to return the
written position that the WriteResult gets from the method that calls
tell.

Question: how much overhead is it to create the WriteResult actors?
Meaning, can I create one WriteResult per call to tell, so that it can
hold a Future to pass in to the onReceive callback? Or are there other
better patterns to achieve synchronous results from the write?

regards, Rickard

Hi, I think you need to look into eventstore.j.EsConnection interface and create EsConnectionImpl out of connection actor

Hi

Hi, I think you need to look into eventstore.j.EsConnection interface and
create EsConnectionImpl out of connection actor

I would, except that one is buggy with regards to configuration, so
the previous recommendation was to go with SubscriptionObserverActor,
which I am now. Is there any way of doing the same thing with the SOA?

cheers, Rickard

Then you can use ask pattern against connection actor - http://doc.akka.io/docs/akka/2.4.1/java/lambda-actors.html#The_Inbox

Hey!

Then you can use ask pattern against connection actor -
http://doc.akka.io/docs/akka/2.4.1/java/lambda-actors.html#The_Inbox

Cool! So, here's what the code ended up like:

Future<?> result = ask(connection, message, writeTimeout);
return Await.result( result, Duration.apply(writeTimeout,
TimeUnit.MILLISECONDS) );

Fairly straightforward. With this I can get the commit position out,
and do a redirect in my REST API to a URL that contains that position,
and a request filter that then waits until that position has been
applied in the database. Read-own-writes in an eventual consistency
system. Happy!

cheers, Rickard

I feel like there should be an easier way of getting the result of a write. Maybe im misunderstanding but there are many cases where you need rhe result such as writing without expected version and getting the assigned version.

Rickard, could you try new version of client, which should fix your configurational issue
http://search.maven.org/#search|ga|1|g%3Acom.geteventstore%20AND%20eventstore-client