{"id":13542912,"url":"https://github.com/temporalio/spring-boot-demo","last_synced_at":"2025-04-02T12:30:40.044Z","repository":{"id":60149397,"uuid":"527853419","full_name":"temporalio/spring-boot-demo","owner":"temporalio","description":"Sample application demonstrating Temporal JavaSDK Spring Boot integration","archived":false,"fork":false,"pushed_at":"2024-01-25T04:27:48.000Z","size":5799,"stargazers_count":22,"open_issues_count":17,"forks_count":8,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-08-01T11:08:43.719Z","etag":null,"topics":["java","spring-boot","temporal"],"latest_commit_sha":null,"homepage":"https://github.com/temporalio/sdk-java/blob/master/temporal-spring-boot-autoconfigure-alpha/README.md","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/temporalio.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":"2022-08-23T06:01:32.000Z","updated_at":"2024-07-17T14:12:42.000Z","dependencies_parsed_at":"2024-01-16T17:02:24.127Z","dependency_job_id":"f143fdd2-8ad8-4e46-a52f-6c467b605648","html_url":"https://github.com/temporalio/spring-boot-demo","commit_stats":null,"previous_names":["tsurdilo/temporal-springboot-demo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/temporalio%2Fspring-boot-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/temporalio%2Fspring-boot-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/temporalio%2Fspring-boot-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/temporalio%2Fspring-boot-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/temporalio","download_url":"https://codeload.github.com/temporalio/spring-boot-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246815249,"owners_count":20838410,"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":["java","spring-boot","temporal"],"created_at":"2024-08-01T11:00:19.702Z","updated_at":"2025-04-02T12:30:37.799Z","avatar_url":"https://github.com/temporalio.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":["Samples"],"readme":"# Temporal Spring Boot Integration Demo\n\n## Links\n\n* [Temporal Java SDK](https://github.com/temporalio/sdk-java)\n* [Spring Boot Integration package](https://github.com/temporalio/sdk-java/tree/master/temporal-spring-boot-autoconfigure-alpha)\n\n## Intro\n\nThis demo showcases Temporal Java SDK integration with Spring Boot.\nIt uses the [Java SDK Spring Boot AutoConfig](https://github.com/temporalio/sdk-java/tree/master/temporal-spring-boot-autoconfigure-alpha).\n\nShown features:\n* [Connection Setup](https://github.com/temporalio/sdk-java/tree/master/temporal-spring-boot-autoconfigure-alpha#connection-setup)\n* [Workflows and Activities auto-discovery](https://github.com/temporalio/sdk-java/tree/master/temporal-spring-boot-autoconfigure-alpha#auto-discovery)\n* [Data converter auto-discovery](https://github.com/temporalio/sdk-java/tree/master/temporal-spring-boot-autoconfigure-alpha#data-converter)\n* [Integration with Metrics (Prometheus)](https://github.com/temporalio/sdk-java/tree/master/temporal-spring-boot-autoconfigure-alpha#metrics)\n* [Integration with Tracing (Jaeger)](https://github.com/temporalio/sdk-java/tree/master/temporal-spring-boot-autoconfigure-alpha#tracing)\n* [Testing](https://github.com/temporalio/sdk-java/tree/master/temporal-spring-boot-autoconfigure-alpha#testing)\n* (todo) [mTLS](https://github.com/temporalio/sdk-java/tree/master/temporal-spring-boot-autoconfigure-alpha#mtls)\n\n## Run Demo\n\n1. First we need to set up Temporal Server. To showcase the metrics\nand tracing capabilities it's easiest to use [this](https://github.com/tsurdilo/my-temporal-dockercompose) repo\nwhich has it all built in and ready to go. If you already have Temporal\nserver running on Docker locally you can clean and prune and then run:\n\n```\ngit clone https://github.com/tsurdilo/my-temporal-dockercompose\ncd my-temporal-dockercompose\ndocker network create temporal-network\ndocker compose -f docker-compose-postgres.yml -f docker-compose-services.yml up\n```\n\n2. This demo depends on the [Temporal Spring Boot Thymeleaf UI](https://github.com/tsurdilo/temporal-springboot-web-ui)\nproject for the web part of it.\nSo first we have to fetch and compile it:\n\n```\ngit clone git@github.com:tsurdilo/temporal-springboot-web-ui.git\ncd temporal-springboot-web-ui\nmvn clean install\n```\n   \n3. Now lets build and start the demo\n\n```\ngit clone git@github.com:tsurdilo/temporal-springboot-demo.git\ncd temporal-springboot-demo\nmvn clean install spring-boot:run\n```\n\n## Use Demo\n\nOnce your demo has started up you can access the ui via\n[localhost:3030](http://localhost:3030/)\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"img/start.png\" width=\"500px\" /\u003e\n\u003c/p\u003e\n\n### Start new Execution\n\nClick on \"Show/Hide\" in the \"Start Workflow Execution\" module\nto expand it. This will let us start a new workflow exec.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"img/startwf.png\" width=\"500px\" /\u003e\n\u003c/p\u003e\n\nOur workflow type is \"DemoWorkflow\" and its running as we specified via annotations \non the \"DemoTaskQueue\" task queue. You can set whichever workflow id you wish.\nThe input of our workflow execution must be in CloudEvents format as \nthat is what our custom data converter expects. \nHere is sample that you can use:\n\n```json\n{\n  \"id\": \"123\",\n  \"source\": \"localhost:3030\",\n  \"type\": \"io.temporal.demo\",\n  \"data\": {\n   \"first\": \"john\",\n   \"last\": \"doe\"\n  }\n}\n```\n\nClick on \"Start Exec\" to start a new workflow execution:\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"img/wfstarted.png\" width=\"500px\" /\u003e\n\u003c/p\u003e\n\n### Signal Execution\nOur execution is in \"Running\" status, as it is waiting on the next \nCloudEvent sent to it to continue. It is going to wait until we do that, \nso let's send it. \nClick on the \"Signal Workflow\" button in the \"Actions\" column:\n\nFill in \"addEvent\" as the signal name, as that is what our demo workflow defines\nas the signal method. Enter in a different CloudEvent in the signal payload, you can use:\n\n```json\n {\n   \"id\": \"124\",\n   \"source\": \"localhost:3030\",\n   \"type\": \"io.temporal.demo\",\n   \"data\": {\n     \"first\": \"marry\",\n     \"last\": \"doe\"\n   }\n }\n ```\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"img/signalwf.png\" width=\"500px\" /\u003e\n\u003c/p\u003e\n\nAnd click the \"Signal\" button.\n\nYou should see that our workflow execution is now in the \"Completed\" status.\n\n### Query Execution\n\nWith Temporal you can query completed workflow executions (up to the \nconfigured retention period on the namespace). So let's try to query it.\nThe query will give us the last event sent to the workflow, so we should\nget the same event as what we just signalled.\n\nFor this click on the \"Query Workflow\" button in \"Actions\",\nset the query name to \"getLastEvent\" as that is what our workflow definition \ndefines as the query name, then click \"Query Workflow\" button:\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"img/querywf.png\" width=\"500px\" /\u003e\n\u003c/p\u003e\n\n### Get Execution Result\n\nNext lets see what our workflow execution results are. Again you can get results \nof completed executions up to configured retention period on the namespace.\n\nFor this click on the \"Get Result\" button in \"Actions\", then click on \"Get Result\" button.\nYou should see the results which is also a CloudEvent that includes all the ids of the so far \nsent signals. For our demo that should be \"123\" and \"124\", the ids of the event\nthat we sent as workflow data input and then the one that we signalled the workflow execution earlier:\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"img/getresult.png\" width=\"500px\" /\u003e\n\u003c/p\u003e\n\n### See Metrics and Tracing Info\n\nFor metrics, in the navbar on top of the page click on \"Grafana\" and \nbrowse the SDK and Server dashboards that come out of the box for you.\n\n\nFor tracing, in the navbar on top of the page click on \"Jaeger\".\nFor service select \"temporal-demo\", and then in the Operation dropdown\nselect \"RunWorkflow:DemoWorkflow\", then click \"Find Traces\".\n\nIn the result select the http post trace which is the one the UI used\nto start our workflow execution:\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"img/traces.png\" width=\"500px\" /\u003e\n\u003c/p\u003e\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftemporalio%2Fspring-boot-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftemporalio%2Fspring-boot-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftemporalio%2Fspring-boot-demo/lists"}