{"id":17933945,"url":"https://github.com/papooch/node-lra","last_synced_at":"2025-04-03T11:24:59.463Z","repository":{"id":103729158,"uuid":"493348872","full_name":"Papooch/node-lra","owner":"Papooch","description":"Experimental LRA client implementation inspired by Microprofile LRA for Java","archived":false,"fork":false,"pushed_at":"2022-06-11T23:05:33.000Z","size":269,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T00:43:25.111Z","etag":null,"topics":["distributed","lra","microservice","transactions"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Papooch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-17T17:25:33.000Z","updated_at":"2024-12-08T21:14:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0cfcacd-cdc3-4be5-bd40-1530f14a7fcd","html_url":"https://github.com/Papooch/node-lra","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/Papooch%2Fnode-lra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Papooch%2Fnode-lra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Papooch%2Fnode-lra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Papooch%2Fnode-lra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Papooch","download_url":"https://codeload.github.com/Papooch/node-lra/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246990842,"owners_count":20865547,"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":["distributed","lra","microservice","transactions"],"created_at":"2024-10-28T21:42:28.230Z","updated_at":"2025-04-03T11:24:59.433Z","avatar_url":"https://github.com/Papooch.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node LRA\r\n\r\nExample \"Long Running Action\" client implementation for Node.js. Inspired by [Micropofile LRA](https://github.com/eclipse/microprofile-lra) specification.\r\n\r\nThis repository aims to implement a compatible Node LRA.js Client (`@node-lra/core`), while also providing integration libraries for various Node frameworks like express (`@node-lra/express`) and hopefully NestJS (`@node/lra-nestjs`).\r\n\r\nThis is done mainly as an excercise and personal interest in the technology, but it might actually become useful one day.\r\n\r\n## Install\r\nThe package manager of choice is `pnpm`, so if you don't have it, install it first\r\n```sh\r\nnpm i -g pnpm\r\n```\r\nInstall dependencies\r\n```\r\npnpm install\r\n```\r\n\r\n## The `express` example\r\n\r\n### Preparation\r\nExecute the `express` example by runing\r\n```\r\npnpm nx serve express-sample\r\n```\r\n\r\nFor sucessful running of the examples, you need a running \"LRA Coordinator\" on port 8080. The coordinator must also see your running apps. You can use `docker` or `podman` in the `network host` mode to achieve that:\r\n\r\n```sh\r\npodman run -it --rm --name lra-coordinator --network host  docker.io/jbosstm/lra-coordinator\r\n```\r\nVerify that the coordinator container can see your running apps with:\r\n```sh\r\npodman exec lra-coordinator curl http://localhost:3333/ping\r\n```\r\nYou shoud get `pong` back.\r\n\r\n### Running the example\r\n\r\nThe express example app consists of 2 services, running on ports `3333` and `3334` respectively.\r\n\r\nTo run the example, send a GET request to `http://localhost:3333/start` and watch the console where the sample app is running\r\n```sh\r\ncurl -X GET http://localhost:3333/start\r\n```\r\n\r\nService A starts a LRA, then calls Service B, which joins the LRA.\r\n\r\nNow, 3 random events could happen:\r\n1) Service B returns successfully, in which case Service A closes the LRA and the Coordinator calls the `complete` endpoint of both services\r\n\r\n2) Service B throws error, and in turn cancels the LRA. The Coordinator calls the `compensate` endpoint of both services\r\n\r\n3) Service B simulates \"Bad Request\" error and leaves the LRA. This causes Service A to cancel the LRA. The Coordinator only calls the `compensate` endpoint of Service A\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpapooch%2Fnode-lra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpapooch%2Fnode-lra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpapooch%2Fnode-lra/lists"}