snippets/split-items-via-or-gateway/src/main/java/com/camunda/demo/gateway/or/split/items/CamundaBpmProcessApplication.java
@PostDeploy
  public void onDeploymentFinished(ProcessEngine processEngine) {
    if (processEngine.getRuntimeService().createProcessInstanceQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).count()==0) {
      
      Order order = new Order()
        .addItem(new Item().setId("01").setText("First Item"))
        .addItem(new Item().setId("02").setText("Second Item"))
        .addItem(new Item().setId("03").setText("Third Item"));
      
      processEngine.getRuntimeService().startProcessInstanceByKey( //
          PROCESS_DEFINITION_KEY, //
          Variables.createVariables().putValueTyped( //
              ProcessVariables.VAR_NAME_ORDER, //
              Variables.objectValue(order).serializationDataFormat(SerializationDataFormats.JSON).create()));
    }
  }
@PostDeploy
  public void onDeploymentFinished(ProcessEngine processEngine) {
    if (processEngine.getRuntimeService().createProcessInstanceQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).count()==0) {
      
      Order order = new Order()
        .addItem(new Item().setId("01").setText("First Item"))
        .addItem(new Item().setId("02").setText("Second Item"))
        .addItem(new Item().setId("03").setText("Third Item"));
      
      processEngine.getRuntimeService().startProcessInstanceByKey( //
          PROCESS_DEFINITION_KEY, //
          Variables.createVariables().putValueTyped( //
              ProcessVariables.VAR_NAME_ORDER, //
              Variables.objectValue(order).serializationDataFormat(SerializationDataFormats.JSON).create()));
    }
  }
@ PostDeploy public void onDeploymentFinished ( ProcessEngine processEngine ) { if ( processEngine . getRuntimeService ( ) . createProcessInstanceQuery ( ) . processDefinitionKey ( PROCESS_DEFINITION_KEY ) . count ( ) == 0 ) { Order order = new Order ( ) . addItem ( new Item ( ) . setId ( "01" ) . setText ( "First Item" ) ) . addItem ( new Item ( ) . setId ( "02" ) . setText ( "Second Item" ) ) . addItem ( new Item ( ) . setId ( "03" ) . setText ( "Third Item" ) ) ; processEngine . getRuntimeService ( ) . startProcessInstanceByKey ( // PROCESS_DEFINITION_KEY , // Variables . createVariables ( ) . putValueTyped ( // ProcessVariables . VAR_NAME_ORDER , // Variables . objectValue ( order ) . serializationDataFormat ( SerializationDataFormats . JSON ) . create ( ) ) ) ; } }
In a @PostDeploy Hook you can interact with the process engine and access
the processes the application has deployed.
In a