From 504a9890542450c01030525ffc9ce9a1effe17a5 Mon Sep 17 00:00:00 2001 From: Christina Ausley Date: Fri, 26 Jul 2024 12:23:21 -0400 Subject: [PATCH 1/3] update spring zeebe guide --- docs/guides/getting-started-java-spring.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/guides/getting-started-java-spring.md b/docs/guides/getting-started-java-spring.md index f4ad27e549..79c454bc66 100644 --- a/docs/guides/getting-started-java-spring.md +++ b/docs/guides/getting-started-java-spring.md @@ -28,6 +28,10 @@ For example, in this guide we will outline a BPMN model to receive a payment req ![example BPMN model to receive a payment request, prepare a transaction, charge a credit card, and execute a payment](./img/prepare-transaction-example.png) +:::note +While stepping through this guide, you can visit our [sample repository](https://github.com/camunda/camunda-8-get-started-spring/blob/main/src/main/java/io/camunda/demo/process_payments/ChargeCreditCardWorker.java) with the completed code to check your work. +::: + ## Step 1: Install Camunda 8 Self-Managed @@ -182,6 +186,7 @@ In your terminal, run `mvn spring-boot:run`, where you should see the `charging To start a process instance programmatically, take the following steps: 1. In `ProcessPaymentsApplication.java`, convert the application to a `CommandLineRunner`, by adding `implements CommandLineRunner` to the `ProcessPaymentsApplication` class declaration. Instantiate a static `Logger` variable, and an instance variable named `zeebeClient` with the `@Autowired` annotation. + 1. Additionally, decorate the `ProcessPaymentsApplication` class with `@Deployment(resources = "classpath:process-payments.bpmn")` in `ProcessPaymentsApplication.java`: ```java @SpringBootApplication @@ -204,14 +209,14 @@ public class ProcessPaymentsApplication implements CommandLineRunner { ```java @Override public void run(final String... args) { - var processDefinitionKey = "process-payments"; + var bpmnProcessId = "process-payments"; var event = zeebeClient.newCreateInstanceCommand() .bpmnProcessId(processDefinitionKey) .latestVersion() .variables(Map.of("total", 100)) .send() .join(); - LOG.info(String.format("started a process: %d", event.getProcessInstanceKey())); + LOG.info("started a process instance: {}", event.getProcessInstanceKey()); } ``` @@ -223,9 +228,6 @@ Re-run the application in your terminal with `mvn spring-boot:run` to see the pr ## Step 8: Deploy the process -To deploy your process, take the following steps: - -1. Decorate the `ProcessPaymentsApplication` class with `@Deployment(resources = "classpath:process-payments.bpmn")` in `ProcessPaymentsApplication.java`: -2. In Desktop Modeler, change the tax amount calculated to `total * 1.2` under **FEEL expression** and save your changes. +To deploy your process, change the tax amount calculated in Desktop Modeler to `total * 1.2` under **FEEL expression** and save your changes. Re-run the application in your terminal with `mvn spring-boot:run` to see the process run. In Operate, note the new version `2` when filtering process instances, and the tax amount has increased for the most recent process instance. From 53e7bc64256fd13b3ec1d4433db623ede1ec1c51 Mon Sep 17 00:00:00 2001 From: Christina Ausley Date: Tue, 30 Jul 2024 14:06:57 -0400 Subject: [PATCH 2/3] resolve comments and backport --- docs/guides/getting-started-java-spring.md | 17 +++++-- .../guides/getting-started-java-spring.md | 48 +++++++++---------- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/docs/guides/getting-started-java-spring.md b/docs/guides/getting-started-java-spring.md index 79c454bc66..608476516c 100644 --- a/docs/guides/getting-started-java-spring.md +++ b/docs/guides/getting-started-java-spring.md @@ -185,12 +185,10 @@ In your terminal, run `mvn spring-boot:run`, where you should see the `charging To start a process instance programmatically, take the following steps: -1. In `ProcessPaymentsApplication.java`, convert the application to a `CommandLineRunner`, by adding `implements CommandLineRunner` to the `ProcessPaymentsApplication` class declaration. Instantiate a static `Logger` variable, and an instance variable named `zeebeClient` with the `@Autowired` annotation. - 1. Additionally, decorate the `ProcessPaymentsApplication` class with `@Deployment(resources = "classpath:process-payments.bpmn")` in `ProcessPaymentsApplication.java`: +1. In `ProcessPaymentsApplication.java`, convert the application to a `CommandLineRunner`, by adding `implements CommandLineRunner` to the `ProcessPaymentsApplication` class declaration. Instantiate a static `Logger` variable, and an instance variable named `zeebeClient` with the `@Autowired` annotation: ```java @SpringBootApplication -@Deployment(resources = "classpath:process-payments.bpmn") public class ProcessPaymentsApplication implements CommandLineRunner { private static final Logger LOG = LoggerFactory.getLogger(ProcessPaymentsApplication.class); @@ -211,7 +209,7 @@ public class ProcessPaymentsApplication implements CommandLineRunner { public void run(final String... args) { var bpmnProcessId = "process-payments"; var event = zeebeClient.newCreateInstanceCommand() - .bpmnProcessId(processDefinitionKey) + .bpmnProcessId(bpmnProcessId) .latestVersion() .variables(Map.of("total", 100)) .send() @@ -228,6 +226,15 @@ Re-run the application in your terminal with `mvn spring-boot:run` to see the pr ## Step 8: Deploy the process -To deploy your process, change the tax amount calculated in Desktop Modeler to `total * 1.2` under **FEEL expression** and save your changes. +To deploy your process, take the following steps: + +1. Decorate the `ProcessPaymentsApplication` class with `@Deployment(resources = "classpath:process-payments.bpmn")` in `ProcessPaymentsApplication.java`: + +```java +@SpringBootApplication +@Deployment(resources = "classpath:process-payments.bpmn") +``` + +2. In Desktop Modeler, change the tax amount calculated to `total * 1.2` under **FEEL expression** and save your changes. Re-run the application in your terminal with `mvn spring-boot:run` to see the process run. In Operate, note the new version `2` when filtering process instances, and the tax amount has increased for the most recent process instance. diff --git a/versioned_docs/version-8.5/guides/getting-started-java-spring.md b/versioned_docs/version-8.5/guides/getting-started-java-spring.md index 19a5f89b19..608476516c 100644 --- a/versioned_docs/version-8.5/guides/getting-started-java-spring.md +++ b/versioned_docs/version-8.5/guides/getting-started-java-spring.md @@ -1,15 +1,22 @@ --- id: getting-started-java-spring -title: Getting started as a Java developer using Spring -sidebar_label: Getting started as a Java developer using Spring +title: Get started as a Java developer using Spring +sidebar_label: Get started with Spring description: "Use Spring Boot and the Spring Zeebe SDK to interact with your local Self-Managed Camunda 8 installation." keywords: [java, spring, spring zeebe, getting started, user guide, tutorial] --- +import SmPrereqs from './react-components/sm-prerequisites.md' +import Install from './react-components/install-plain-java.md' + Beginner -1 hour +1 hour

+ +:::note +This tutorial is not intended for production purposes. +::: -In this guide, we'll step through using Spring Boot and the [Spring Zeebe SDK](/apis-tools/spring-zeebe-sdk/getting-started.md) with Desktop Modeler to interact with your local Self-Managed Camunda 8 installation. +In this guide, we'll step through using Spring Boot and the [Spring Zeebe SDK](/apis-tools/spring-zeebe-sdk/getting-started.md) with Desktop Modeler to interact with your local Self-Managed Camunda 8 installation. While this guide focuses on Self-Managed, you can do something similar with [SaaS](https://signup.camunda.com/accounts?utm_source=docs.camunda.io&utm_medium=referral). By the end of this tutorial, you'll be able to use Spring and Java code with Zeebe to: @@ -22,26 +29,14 @@ For example, in this guide we will outline a BPMN model to receive a payment req ![example BPMN model to receive a payment request, prepare a transaction, charge a credit card, and execute a payment](./img/prepare-transaction-example.png) :::note -This tutorial is not intended for production purposes. +While stepping through this guide, you can visit our [sample repository](https://github.com/camunda/camunda-8-get-started-spring/blob/main/src/main/java/io/camunda/demo/process_payments/ChargeCreditCardWorker.java) with the completed code to check your work. ::: -## Prerequisites - -Before getting started, ensure you: - -- Can access your preferred code editor or IDE. -- Have Java [installed locally](https://www.java.com/en/download/). Currently, the Spring Initializr supports Java versions 17, 21, and 22. -- Have [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed locally. -- Install [Desktop Modeler](https://camunda.com/download/modeler/). + ## Step 1: Install Camunda 8 Self-Managed -If you haven't already, follow [this guide](/self-managed/setup/deploy/local/docker-compose.md) to install Camunda 8 Self-Managed locally via Docker Compose: - -1. Use the `docker-compose.yaml` file in [this repository](https://github.com/camunda/camunda-platform). -2. Clone this repo and run `docker compose up -d` in your terminal to start your environment. - -To confirm Camunda 8 Self-Managed is installed, click into Docker Desktop. Here, you will see the `camunda-platform` container. Alternatively, navigate to the different components and log in with the username `demo` and password `demo`. For example, Operate can be accessed at [http://localhost:8081](http://localhost:8081) (as noted under **Port(s)** in the Docker container). Find additional guidance in the repository [README](https://github.com/camunda/camunda-platform?tab=readme-ov-file#using-docker-compose). + ## Step 2: Create a new Spring Boot project @@ -190,11 +185,10 @@ In your terminal, run `mvn spring-boot:run`, where you should see the `charging To start a process instance programmatically, take the following steps: -1. In `ProcessPaymentsApplication.java`, convert the application to a `CommandLineRunner`, by adding `implements CommandLineRunner` to the `ProcessPaymentsApplication` class declaration. Instantiate a static `Logger` variable, and an instance variable named `zeebeClient` with the `@Autowired` annotation. +1. In `ProcessPaymentsApplication.java`, convert the application to a `CommandLineRunner`, by adding `implements CommandLineRunner` to the `ProcessPaymentsApplication` class declaration. Instantiate a static `Logger` variable, and an instance variable named `zeebeClient` with the `@Autowired` annotation: ```java @SpringBootApplication -@Deployment(resources = "classpath:process-payments.bpmn") public class ProcessPaymentsApplication implements CommandLineRunner { private static final Logger LOG = LoggerFactory.getLogger(ProcessPaymentsApplication.class); @@ -213,14 +207,14 @@ public class ProcessPaymentsApplication implements CommandLineRunner { ```java @Override public void run(final String... args) { - var processDefinitionKey = "process-payments"; + var bpmnProcessId = "process-payments"; var event = zeebeClient.newCreateInstanceCommand() - .bpmnProcessId(processDefinitionKey) + .bpmnProcessId(bpmnProcessId) .latestVersion() .variables(Map.of("total", 100)) .send() .join(); - LOG.info(String.format("started a process: %d", event.getProcessInstanceKey())); + LOG.info("started a process instance: {}", event.getProcessInstanceKey()); } ``` @@ -235,6 +229,12 @@ Re-run the application in your terminal with `mvn spring-boot:run` to see the pr To deploy your process, take the following steps: 1. Decorate the `ProcessPaymentsApplication` class with `@Deployment(resources = "classpath:process-payments.bpmn")` in `ProcessPaymentsApplication.java`: + +```java +@SpringBootApplication +@Deployment(resources = "classpath:process-payments.bpmn") +``` + 2. In Desktop Modeler, change the tax amount calculated to `total * 1.2` under **FEEL expression** and save your changes. Re-run the application in your terminal with `mvn spring-boot:run` to see the process run. In Operate, note the new version `2` when filtering process instances, and the tax amount has increased for the most recent process instance. From 8a1d071f79eaba27775ce7c704ffff90da1941bf Mon Sep 17 00:00:00 2001 From: Christina Ausley Date: Wed, 31 Jul 2024 08:48:01 -0400 Subject: [PATCH 3/3] update 8.5 docs --- .../guides/getting-started-java-spring.md | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/versioned_docs/version-8.5/guides/getting-started-java-spring.md b/versioned_docs/version-8.5/guides/getting-started-java-spring.md index 565d5c833a..e272238f80 100644 --- a/versioned_docs/version-8.5/guides/getting-started-java-spring.md +++ b/versioned_docs/version-8.5/guides/getting-started-java-spring.md @@ -1,22 +1,15 @@ --- id: getting-started-java-spring -title: Get started as a Java developer using Spring -sidebar_label: Get started with Spring +title: Getting started as a Java developer using Spring +sidebar_label: Getting started as a Java developer using Spring description: "Use Spring Boot and the Spring Zeebe SDK to interact with your local Self-Managed Camunda 8 installation." keywords: [java, spring, spring zeebe, getting started, user guide, tutorial] --- -import SmPrereqs from './react-components/sm-prerequisites.md' -import Install from './react-components/install-plain-java.md' - Beginner -1 hour

+1 hour -:::note -This tutorial is not intended for production purposes. -::: - -In this guide, we'll step through using Spring Boot and the [Spring Zeebe SDK](/apis-tools/spring-zeebe-sdk/getting-started.md) with Desktop Modeler to interact with your local Self-Managed Camunda 8 installation. While this guide focuses on Self-Managed, you can do something similar with [SaaS](https://signup.camunda.com/accounts?utm_source=docs.camunda.io&utm_medium=referral). +In this guide, we'll step through using Spring Boot and the [Spring Zeebe SDK](/apis-tools/spring-zeebe-sdk/getting-started.md) with Desktop Modeler to interact with your local Self-Managed Camunda 8 installation. By the end of this tutorial, you'll be able to use Spring and Java code with Zeebe to: @@ -32,11 +25,27 @@ For example, in this guide we will outline a BPMN model to receive a payment req While stepping through this guide, you can visit our [sample repository](https://github.com/camunda/camunda-8-get-started-spring/blob/main/src/main/java/io/camunda/demo/process_payments/ChargeCreditCardWorker.java) with the completed code to check your work. ::: - +:::note +This tutorial is not intended for production purposes. +::: + +## Prerequisites + +Before getting started, ensure you: + +- Can access your preferred code editor or IDE. +- Have Java [installed locally](https://www.java.com/en/download/). Currently, the Spring Initializr supports Java versions 17, 21, and 22. +- Have [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed locally. +- Install [Desktop Modeler](https://camunda.com/download/modeler/). ## Step 1: Install Camunda 8 Self-Managed - +If you haven't already, follow [this guide](/self-managed/setup/deploy/local/docker-compose.md) to install Camunda 8 Self-Managed locally via Docker Compose: + +1. Use the `docker-compose.yaml` file in [this repository](https://github.com/camunda/camunda-platform). +2. Clone this repo and run `docker compose up -d` in your terminal to start your environment. + +To confirm Camunda 8 Self-Managed is installed, click into Docker Desktop. Here, you will see the `camunda-platform` container. Alternatively, navigate to the different components and log in with the username `demo` and password `demo`. For example, Operate can be accessed at [http://localhost:8081](http://localhost:8081) (as noted under **Port(s)** in the Docker container). Find additional guidance in the repository [README](https://github.com/camunda/camunda-platform?tab=readme-ov-file#using-docker-compose). ## Step 2: Create a new Spring Boot project