On Fri, Dec 2, 2011 at 3:45 PM, Dmytrii Nagirniak <dna...@gmail.com> wrote:
> > On 03/12/2011, at 12:50 AM, Rick Bullotta wrote: > > > I also agree with you that it would be nice to have transaction support > over a remote API, but that's not a trivial thing to accomplish in a web > scenario when there is not any "thread affinity" or even necessarily > "server affinity" between requests that occur within a transaction. > Knowing when to abandon a pending transaction in a scenario where the > client(s) do not maintain a persistent connection is also quite challenging. > > You just meant to say that HTTP is stateless? :) > I proposed one solution in the other thread. > > Basically: > 1. you POST to /transactions?timeout=1000 to request a start of a > transaction. > 2. The server returns a transaction id for the client to use. > 3. Client can PUT /transactions/1234/commit|rollback > 4. Otherwise server rolls it back after timeout (which may default to 1 > second and can't be longer that configured). > > It has additional benefit that you can combine transaction with batching: > > 1. GET /nodes/123 > 2. POST /transactions/ > 3. POST /batch - update everything in a batch, including the transaction > itself. > > Thus additional request to commit/rollback the transaction is not even > necessary as in can be batched. > This is similar to the approach we're looking at, except interaction currently looks like: POST /tx 200: 1 POST /tx/1/node {"name":"Steven"} 201 POST /tx/1/batch [blah blah] 200 PUT /tx/1/state "COMMITTED" /jake > > > > One possibility might be to leverage another RPC mechanism or perhaps > even something like Web Sockets in the not too distant future. But I think > the goal of a language neutral binding also needs to be preserved if > possible. > HTTP has its advantages. It can be heavily cached by reverse-proxy for > example :) > > _______________________________________________ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- Jacob Hansson Phone: +46 (0) 763503395 Twitter: @jakewins _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user