{"id":13529855,"url":"https://github.com/jexp/neo4j-tx-participation","last_synced_at":"2025-04-05T00:15:43.898Z","repository":{"id":32580885,"uuid":"36163955","full_name":"jexp/neo4j-tx-participation","owner":"jexp","description":"This is a Neo4j Server Extension to make Neo4j REST-API participate in transactions started by the transactional Cypher endpoint.","archived":false,"fork":false,"pushed_at":"2015-05-24T08:56:34.000Z","size":104,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-10T08:31:12.705Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jexp.png","metadata":{"files":{"readme":"Readme.adoc","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-24T08:56:24.000Z","updated_at":"2015-09-25T12:30:50.000Z","dependencies_parsed_at":"2022-08-24T20:30:23.078Z","dependency_job_id":null,"html_url":"https://github.com/jexp/neo4j-tx-participation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jexp%2Fneo4j-tx-participation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jexp%2Fneo4j-tx-participation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jexp%2Fneo4j-tx-participation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jexp%2Fneo4j-tx-participation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jexp","download_url":"https://codeload.github.com/jexp/neo4j-tx-participation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266570,"owners_count":20910837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:00:40.033Z","updated_at":"2025-04-05T00:15:43.879Z","avatar_url":"https://github.com/jexp.png","language":"Java","funding_links":[],"categories":["Extensions","REST API"],"sub_categories":["REST API","Other"],"readme":"== Transaction-Participation for Neo4j-REST-API\n\nThis is a Neo4j Server Extension to make http://neo4j.com/docs/stable/rest-api.html[Neo4j REST-API] participate in transactions started by the http://neo4j.com/docs/stable/rest-api-transactional.html#rest-api-begin-a-transaction[transactional Cypher endpoint].\n\n=== Why do I need it?\n\nThere are a number of operations with Neo4j server that currently can't be done with Cypher but are exposed as REST-API endpoints.\n\nNotably working with http://neo4j.com/docs/stable/rest-api-indexes.html[manual indexes], http://neo4j.com/docs/stable/rest-api-traverse.html[traversals] and http://neo4j.com/docs/stable/rest-api-graph-algos.html[graph algorithms].\n\nAs the Cypher endpoint starts it's own transactions, all the data created during those transactions *is not visible* to the outside until that transaction is committed.\nSo you can't create a node and add it to a manual fulltext or spatial index within the same transaction.\n\nThis extension makes it possible for other REST-operations to participate in transactions started by the cypher endpoint.\n\n=== Installation\n\nYou can build it with `mvn package` and copy `target/transaction-participation-2.2.2-1.0-SNAPSHOT.jar` to your server's `plugins` directory.\n\nA pre-built version is https://dl.dropboxusercontent.com/u/14493611/transaction-participation-2.2.2-1.0-SNAPSHOT.jar[here].\n\nAnd edit `conf/neo4j-server.properties` to contain this registration for the extension:\n----\norg.neo4j.server.thirdparty_jaxrs_classes=org.neo4j.server.extension.tx=/tx\n----\n\nThen restart your server.\n\n=== How does it work?\n\nThe extension installs a filter that intercepts the http request to the REST API takes the *transaction id from the `X-TxId` HTTP Header*\nand resumes the transaction, so that the REST-API calls participates in that transaction.\n\nAfter executing the request it suspends the transaction again, so that you can continue it with the Cypher endpoint and also committing it at the end.\n\nHere is a sample session with explanations:\n----\n# open transaction, create node\ncurl -i -H accept:application/json -H content-type:application/json \\\n     -d '{\"statements\":[{\"statement\":\"create (p:Person {name:\\\"Jack\\\"}) return id(p)\"}]}' \\\n     http://localhost:7474/db/data/transaction\n\n# response, see the transaction-id \"6\" and the returned node-id of \"1\" (nested in \"data\":[{\"row\":[1]}]}])\nHTTP/1.1 201 Created\nLocation: http://localhost:7474/db/data/transaction/6\n{\"commit\":\"http://localhost:7474/db/data/transaction/6/commit\",\n \"results\":[{\"columns\":[\"id(p)\"],\"data\":[{\"row\":[1]}]}],\n \"transaction\":{\"expires\":\"Sun, 24 May 2015 08:43:11 +0000\"},\n \"errors\":[]}\n\ncurl -H X-TxId:6 \\\n     -i -H accept:application/json -H content-type:application/json \\\n     -d'{\"key\":\"bio\",\"value\":\"Jack was born in London in 1925\",\"uri\":\"/db/data/node/1\"}' \\\n     http://localhost:7474/db/data/index/node/people\n\n# response, added to index\n\nHTTP/1.1 201 Created\n{  ...\n   \"indexed\" : \"http://localhost:7474/db/data/index/node/people/bio/Jack%20was%20born%20in%20London%20in%201925/1\"\n}\n\n# commit transaction number 6\ncurl  -i -XPOST \\\n      http://localhost:7474/transaction/6\n----\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjexp%2Fneo4j-tx-participation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjexp%2Fneo4j-tx-participation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjexp%2Fneo4j-tx-participation/lists"}