{"id":24553000,"url":"https://github.com/npdeehan/idempotent-process-example","last_synced_at":"2026-01-25T17:02:18.331Z","repository":{"id":90222831,"uuid":"283514754","full_name":"NPDeehan/idempotent-process-example","owner":"NPDeehan","description":"How to build a Camunda process that will only start one instance per request.","archived":false,"fork":false,"pushed_at":"2022-07-25T12:13:42.000Z","size":98,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T09:44:32.574Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/NPDeehan.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-29T14:02:31.000Z","updated_at":"2023-04-24T10:53:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2830dfb-5da7-469f-9066-a15db102b847","html_url":"https://github.com/NPDeehan/idempotent-process-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NPDeehan/idempotent-process-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2Fidempotent-process-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2Fidempotent-process-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2Fidempotent-process-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2Fidempotent-process-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NPDeehan","download_url":"https://codeload.github.com/NPDeehan/idempotent-process-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2Fidempotent-process-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28755561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T16:32:25.380Z","status":"ssl_error","status_checked_at":"2026-01-25T16:32:09.189Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-01-23T01:33:47.575Z","updated_at":"2026-01-25T17:02:18.312Z","avatar_url":"https://github.com/NPDeehan.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Idempotent Camunda Process\n How to build a Camunda process that will only start one instance per request.\n This is quite a common requirements and I came across this quite nice pattern when working with a client. In the past people have tried to solve this problem by either over-riding the REST API or by messing around in the database. Personally I think this BPMN solution works really well.\n\n The process is really simple. A message ``Question`` is sent into the engine via the REST API. This will start an instance of a question answering process. There is a user task which is active until the question is answered at which point the process ends.\n\n ![basic-process](./img/basic-process.png)\n\n In order to make it Idempotent we need to add an event based sub process which waits for the same ``Question`` message as the start event. This can be used to catch all messages after the first one. Making the event sub process non-interupting means that we can catch the message without affecting the ``Answer Question`` task.\n\n ![complete-process](./img/complete-process.png)\n\n To start the process you make the following REST call from [Postman](https://www.postman.com/) or any REST client of your choice.\n\n```\nPOST\nhttp://localhost:8080/engine-rest/message\n\nContent-Type : application/json\n```\nThe body should be as follows:\n\n```JavaScript\n{\n    \"messageName\": \"Question\",\n    \"businessKey\": \"1\",\n    \"processVariables\":\n      \t{\n          \"question\" : {\"value\" : \"Who is Garth Marenghi?\", \"type\": \"String\"}\n        },                 \n    \"all\": false,\n    \"resultEnabled\": true,\n    \"variablesInResultEnabled\": true\n}\n\n```\n\nThe ``businessKey`` is the important part - There will only be one active process with that business key at any time.\n\nThe first time you send the request you'll get a ``200 OK`` back and you can check the returned variable ``status`` to see happening - it should say:\n\n```JSON\n\"status\": {\n               \"type\": \"String\",\n               \"value\": \"Starting Work on the Question\",\n               \"valueInfo\": {}\n           }\n```       \n\nIf you send the same request again it will be caught by the event subprocess and you should get a ``200 OK`` and a different status.\n\n```json\n\"status\": {\n    \"type\": \"String\",\n    \"value\": \"Still Working on the question\",\n    \"valueInfo\": {}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpdeehan%2Fidempotent-process-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpdeehan%2Fidempotent-process-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpdeehan%2Fidempotent-process-example/lists"}