Loading a bpmn file from a standalone project

Hey,
I am trying to create a standalone Process Engine. This is the code that I am using:

    ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
	ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
	ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()
			  .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
			  .setJdbcUrl("jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000")
			  .setJobExecutorActivate(true)
			  .buildProcessEngine();
	
	System.out.println("It's working!!!!");

I would like to load a bpmn file that I created that defines a process from this code. But I am not able to find any documentation about that.

Do you have any ideas?

Thank you,
Riccardo

Something like this would work

  processEngine.getRepositoryService()
	  .createDeployment()
	  .addClasspathResource("location of your BPMN file")
	  .deploy();
1 Like

I found a solution. This is the code that I used:

String processBpmnId = "my_process";
RepositoryService repositoryService = processEngine.getRepositoryService();		
BpmnModelInstance instance = loadBpmnProcess(processBpmnPath);
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().name(processBpmnId);
deploymentBuilder.addModelInstance(processBpmnId + ".bpmn", instance);
deploymentBuilder.deploy();

Anyhow thanks!