Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save berndruecker/dbc22c3bb92719be40d41bc9cbbb88d6 to your computer and use it in GitHub Desktop.
Save berndruecker/dbc22c3bb92719be40d41bc9cbbb88d6 to your computer and use it in GitHub Desktop.
@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);
}
}
@falko
Copy link

falko commented May 17, 2022

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

@berndruecker
Copy link
Author

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