Created
May 10, 2022 09:06
-
-
Save berndruecker/dbc22c3bb92719be40d41bc9cbbb88d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class CreateCustomerInCrmJavaDelegate implements JavaDelegate { | |
@Autowired | |
private ObjectMapper objectMapper; | |
@Autowired | |
private CrmFacade crmFacade; | |
public void execute(DelegateExecution execution) throws Exception { | |
// Data Input Mapping | |
String customerDataJson = (String) execution.getVariable("customerData"); | |
CustomerData customerData = objectMapper.readValue(customerDataJson, CustomerData.class); | |
// Delegate to business logic | |
String customerId = crmFacade.createCustomer(customerData); | |
// Data Output Mapping | |
execution.setVariable("customerId", customerId); | |
} | |
} |
I would not try to fit in too much in one go. If they have the code above - that would at least still work if "adapted" - which would be my main point.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One could use the object mapping of the Spin API to make this look nicer and be closer to how it would look like with Spring Zeebe: https://github.com/camunda-community-hub/camunda-8-process-solution-template/blob/main/src/main/java/org/example/camunda/process/solution/worker/MyWorker.java