Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update spring zeebe guide #4072

Merged
merged 4 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions docs/guides/getting-started-java-spring.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
:::

<SmPrereqs/>

## Step 1: Install Camunda 8 Self-Managed
Expand Down Expand Up @@ -202,7 +206,6 @@ import io.camunda.zeebe.spring.client.annotation.Deployment;

```java
@SpringBootApplication
@Deployment(resources = "classpath:process-payments.bpmn")
public class ProcessPaymentsApplication implements CommandLineRunner {

private static final Logger LOG = LoggerFactory.getLogger(ProcessPaymentsApplication.class);
Expand All @@ -221,14 +224,14 @@ public class ProcessPaymentsApplication implements CommandLineRunner {
```java
@Override
public void run(final String... args) {
var processDefinitionKey = "process-payments";
var bpmnProcessId = "process-payments";
christinaausley marked this conversation as resolved.
Show resolved Hide resolved
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());
}
```

Expand All @@ -243,6 +246,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.
17 changes: 13 additions & 4 deletions versioned_docs/version-8.5/guides/getting-started-java-spring.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,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.
:::

:::note
This tutorial is not intended for production purposes.
:::
Expand Down Expand Up @@ -211,7 +215,6 @@ import io.camunda.zeebe.spring.client.annotation.Deployment;

```java
@SpringBootApplication
@Deployment(resources = "classpath:process-payments.bpmn")
public class ProcessPaymentsApplication implements CommandLineRunner {

private static final Logger LOG = LoggerFactory.getLogger(ProcessPaymentsApplication.class);
Expand All @@ -230,14 +233,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());
}
```

Expand All @@ -252,6 +255,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.
Loading