{"id":24552991,"url":"https://github.com/npdeehan/multi-instance-user-example","last_synced_at":"2026-01-03T14:06:55.024Z","repository":{"id":90222856,"uuid":"331593651","full_name":"NPDeehan/Multi-Instance-User-Example","owner":"NPDeehan","description":"A Camunda example showing how multiple user inputs can be used to decided the path of a process. ","archived":false,"fork":false,"pushed_at":"2021-01-21T10:54:42.000Z","size":113,"stargazers_count":2,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T01:34:33.866Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","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":"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":"2021-01-21T10:33:03.000Z","updated_at":"2023-12-16T08:15:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"3bf51bb0-b94c-48e1-81de-7a7782318a13","html_url":"https://github.com/NPDeehan/Multi-Instance-User-Example","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/NPDeehan%2FMulti-Instance-User-Example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2FMulti-Instance-User-Example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2FMulti-Instance-User-Example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2FMulti-Instance-User-Example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NPDeehan","download_url":"https://codeload.github.com/NPDeehan/Multi-Instance-User-Example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243878491,"owners_count":20362433,"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":"2025-01-23T01:33:47.129Z","updated_at":"2026-01-03T14:06:54.986Z","avatar_url":"https://github.com/NPDeehan.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Camunda Multi-Instance User Task Example\n\nThis is a simple example project to help demonstrate how inputs from multiple \nusers can be gathered together to help decide how the process should proceed based on the \nuser consensus. \n\nThe example uses the idea of a vote. Where X users in parallel are asked to cast a vote\n`yes`or `no`for a candidate. If the majority vote `yes` the process moves on to a user task congradulated the \nvictor is not, we console them. \n\n![Token Flow Vote](./src/main/resources/image/TokenFlowVote.gif)\n\n## To Run the Project\nThis is a Spring Boot project with an embedded Camunda engine. \nTo run it simply import it into your Java IDE and build it with maven to get the dependencies\nand run the ``Application.java`` class from within your IDE. \n\n## How does it work\n\nWhen the process starts it will create a user task for each vote needed.\nAfter each user task is completed a listener will add the vote to the running tally.\n\n```java\n\n@Named\npublic class VoteCountListener implements TaskListener {\n\n    @Override\n    public void notify(DelegateTask delegateTask) {\n        // Get the current variables\n        Long yesVotes = (Long) delegateTask.getVariable(\"yesVotes\");\n        Long noVotes = (Long) delegateTask.getVariable(\"noVotes\");\n        boolean approved = (boolean)delegateTask.getVariable(\"approved\");\n\n        if(approved){\n            delegateTask.setVariable(\"yesVotes\", yesVotes+1L);\n        }else{\n            delegateTask.setVariable(\"noVotes\", noVotes+1L);\n        }\n        \n        // Now i'll removed the variables so that no other task are affected by it.\n        delegateTask.removeVariable(\"approved\");\n        delegateTask.removeVariable(\"name\");\n\n\n    }\n}\n\n```\nAfter all votes are completed a simple expression on the sequence flows leaving the \nXOR gateway will decide on the direction. \n`` #{yesVotes \u003e noVotes} `` in the case of a draw votes will be recast. \n\nIf you feel this example is missing something, I'm very happy to get pull requests. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpdeehan%2Fmulti-instance-user-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpdeehan%2Fmulti-instance-user-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpdeehan%2Fmulti-instance-user-example/lists"}