My work starts from Create Order.This task will be triggered from some GUI screen. I have written a RestController which will be exposed to GUI.How can i map CreateOrderController to the Camunda CreateOrder task .And I need to pass OrderInfo object to the next task i.e."Place Order"
@RestController
public class CreateOrderController {
@PostMapping("/rest/create/order")
public String createOrder(@RequestBody OrderInfo orderInfo) {
System.out.println(" Order created with Order id " + orderInfo.getOrderId());
return "Order id created with " + orderInfo.getOrderId() ;
}
From within you controller, you can use the Java API https://docs.camunda.org/javadoc/camunda-bpm-platform/7.18/org/camunda/bpm/engine/TaskService.html#complete(java.lang.String,java.util.Map) if the controller is running in the same JVM. If the controller is running on a different environment you need to use the REST API:https://docs.camunda.org/manual/7.18/reference/rest/task/post-complete/
...but is the instance already running when you perform the user task? It seems like you may want to remove the user task and instead start the process from your rest controller. For this you should look at: https://docs.camunda.org/javadoc/camunda-bpm-platform/7.18/org/camunda/bpm/engine/RuntimeService.html#startProcessInstanceById(java.lang.String) or https://docs.camunda.org/manual/7.18/reference/rest/process-definition/post-start-process-instance/
You may also find the free training on Camunda Academy helpful: https://academy.camunda.com/page/camunda-7