Spring example for CMMN engine

Hello community!

Does anyone have an example of instantiating the CMMN engine with Spring?

Thanks.
Nirav

Hi Nirav

what exactly is the problem? There are no separate engines for bpmn and cmmn, so I would suggest to just deploy your case plan to spring boot and start playing around with the cockpit. It should work out of the box.

regards
Jan

Jan,

I took the core example with spring boot enabled for REST and the admin web apps. The CMMN model is in the resources as with the examples, and I’m assuming the engine somehow detects and deploys this. I start the process using:

@Component
	public class ApplicationStartup 
	implements ApplicationListener<ApplicationReadyEvent> {
		@Override
		  public void onApplicationEvent(final ApplicationReadyEvent event) {
			caseService.createCaseInstanceByKey("loan_application",
			        Variables.createVariables()
			          .putValue("applicationSufficient", Variables.booleanValue(null))
			          .putValue("rating", Variables.integerValue(null)));
			LOGGER.info("Process registered");
		  }
	}

My build creates an executable jar. Upon execution, I launch the web app, create the initial user, login and should expect to see the tasks in my task list. The task list is empty, and also there are no deployed processes. What am I missing?

The project is at https://github.com/namehta/cmmn-demo-1

Hi Nirav,

You have to create a filter first to see the tasks in the taskmanager. An empty one should be sufficient.

Best
Malte

with 2.0.0 its also possible to have admin user and filter created on start, see https://camunda.github.io/camunda-bpm-spring-boot-starter/docs/2.0.0/index.html#properties

camunda.bpm.filter.create

and

camunda.bpm.admin-user.id
camunda.bpm.admin-user.password

Thanks Malte. Tried that, but that didn’t work. In the cockpit, I see that the model is deployed, but there are no running instances of anything. Seems like the deployment hook for the Spring application startup fired sooner than the process engine instantiation. To counter this, I used a “@PostDeploy”, but that too seems to have the same problem. What is the best hook to instantiate the case?

Jan,

I’m new to Camunda. Apologies for the silly question, but is 2.0.0 not available to the community and listed on maven central? I can’t seem to find a repository to reference.

  • Nirav

No prob … 2.0.0 is available on maven central … but we changed the groupId, so maybe you are looking in the wrong location …

The correct maven dependency settings are the first paragraph of the README, though: https://github.com/camunda/camunda-bpm-spring-boot-starter

Thanks Jan. That worked for me.

As I suspected, the issue was indeed related to the init hook. The default case instance creation was just for testing anyways, so I created a dedicated REST endpoint to initiate a process instance and it worked.

Thanks everyone for the help … which I will most likely need more of as I foray into CMMN!