{"id":24552984,"url":"https://github.com/npdeehan/sendemailcamunda8example","last_synced_at":"2025-09-04T15:40:02.982Z","repository":{"id":90222885,"uuid":"456546652","full_name":"NPDeehan/SendEmailCamunda8Example","owner":"NPDeehan","description":"This is an example project that shows how you can send an email using Camunda Cloud","archived":false,"fork":false,"pushed_at":"2022-04-13T11:21:32.000Z","size":74,"stargazers_count":4,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T09:44:32.530Z","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":"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":"2022-02-07T14:46:12.000Z","updated_at":"2024-03-25T15:57:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"e73ed592-6fb8-4ebc-b680-b82a648985ff","html_url":"https://github.com/NPDeehan/SendEmailCamunda8Example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NPDeehan/SendEmailCamunda8Example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2FSendEmailCamunda8Example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2FSendEmailCamunda8Example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2FSendEmailCamunda8Example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2FSendEmailCamunda8Example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NPDeehan","download_url":"https://codeload.github.com/NPDeehan/SendEmailCamunda8Example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NPDeehan%2FSendEmailCamunda8Example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263818958,"owners_count":23516092,"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.046Z","updated_at":"2025-07-05T22:41:27.047Z","avatar_url":"https://github.com/NPDeehan.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Send Email Worker Camunda 8 Example\n\nThis is an example project that shows how you can send an email using Camunda 8\n\n## Prerequisites\n\nTo use this project you need to setup some stuff, some you might already have, but you can follow the requirements list and you'll be all set.\n\n### Camunda 8 Account\nPop along to camunda.io and create a Camunda 8 account. You'll need to create a cluster and setup client connection credentials. If you don't know how to do that, [just follow this tutorial](https://docs.camunda.io/docs/guides/getting-started/).\n\n### Camunda Desktop Modeler (Optional)\nYou can [download it here](https://camunda.com/download/modeler/) for all the usual platforms.\n\n### Gernate App Password in Email account.\nThis exmaple was built using a GMAIL account and it's pretty easy to setup a GMAIL account that give access to this worker so that it can send emails. You can follow [this tutorial](https://www.javacodemonk.com/spring-boot-send-email-with-gmail-smtp-5caea8f3) to set it up.\n\n## Configure Worker\n\nAssuming you've already configured the connection to Camunda 8/Zeebe mentioned above you just need to connect to your email server, all of that is done in the `application.yml` file. Replacing the username and password with yours should be all you nee dto do\n\n```yaml\nspring.mail:\n  host: smtp.gmail.com\n  port: 587\n  username: yourEmailAddress\n  password: YourAppPassword\n  properties.mail.smtp:\n    auth: true\n    starttls.enable: true\n\n```\n\n## What is the Send Email worker doing?\n\nFirst the worker will subscribe to a specific job or topic, this is determined by the annotation at the top of the class, in this case it's `SendEmail`\n\n```java\n    @ZeebeWorker(type = \"SendEmail\")\n  ```\n\nOnce a job becomes fetched by the worker it will get the variables it needs from the process and then validate that the email address is indeed valid. If for whatever reason the email address doesn't pass validation, it will send a [BPMN error](https://docs.camunda.io/docs/components/modeler/bpmn/error-events/error-events/) back to the engine. \n\n```Java\n   client.newThrowErrorCommand(job)\n                    .errorCode(\"INVALID_EMAIL\")\n                    .send();\n```\n\nIt's then up to the process how it wants to deal with it - it most cases a process should catch this with a [BPMN Error boundary event](https://docs.camunda.io/docs/components/modeler/bpmn/error-events/error-events/). \n\nIf everything is in order the email will be sent and if successful the worker will tell process that the task has been successfully complete, with a variable describing the status.\n\n```Java\n variables.put(\"result\", resultMessage);\n client.newCompleteCommand(job.getKey())\n          .variables(variables)\n          .send()\n          .exceptionally((throwable -\u003e {\n               throw new RuntimeException(\"Could not complete job\", throwable);\n           }));\n```\n\n## Deploy the example process\n\n![Process](./ExampleProcess/SendEmail.png)\n\nIf you'd like to try out the worker, I've added a simple process that demonstrates all the capabilities.\nthe fastest way to deploy and start the process is:\n1. Go to the `Diagrams` section of your camunda cloud account\n1. Create a new diagram\n1. Beside the `New Diagram`name there's a menu where you can upload a model.\n1. Select the `SendEmail` process from the `ExampleProcess` folder and it should appear.\n1. Click the Execute button on the top left.\n\nOne you've deployed and started the instance you can go to your Camunda 8 cluster and open up Tasklist, you'll see your task where you can enter the details of your email.\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpdeehan%2Fsendemailcamunda8example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpdeehan%2Fsendemailcamunda8example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpdeehan%2Fsendemailcamunda8example/lists"}