Best strategy for building an app on top of Camunda.

388 views
Skip to first unread message

cmastr...@gmail.com

unread,
Feb 24, 2015, 3:18:19 PM2/24/15
to camunda-...@googlegroups.com
Hello everyone,

I am planning to build an application on top of Camunda BPM (that is, without using cockpit or tasklist, just my App using the bpm engine with process definition and process instances) and I'm facing some questions.

1) Embedded Process Engine vs. Container-Managed Process Engine. Which one is best for this case? I think the embedded way gives more independence of the app server, so I can deploy in wildfly or tomcat without lots of effort... but, is that right?

2) I just started with embedding the Process Engine with maven, and configured a Process-Archive and a Process-Engine in the processes.xml file. Should I configure a job-executor? how? because I cannot add it to the processes.xml file.

As for performance or separation of responsibilities, which strategy fit best?

Thanks in advance!
Cristian.

thorben....@camunda.com

unread,
Feb 26, 2015, 4:23:02 AM2/26/15
to camunda-...@googlegroups.com
Hi Cristian,

Embedded engine sounds good for that use case as its setup is simpler than that of a shared engine and you do not seem to need the capabilities of a shared engine.

With an embedded engine, you can use the EmbeddedProcessApplication class to deploy your processes to the engine (see [1]). In that case, however, you should not configure the process engine itself in the processes.xml file but use any of the methods for bootstrapping described in [2]. If you use programmatic bootstrapping of the process engine, you can set a JobExecutor object on the process engine configuration. Please ask if you need clarification in that area.

Cheers,
Thorben

[1] http://docs.camunda.org/latest/guides/user-guide/#process-applications-the-process-application-class-the-embeddedprocessapplication
[2] http://docs.camunda.org/latest/guides/user-guide/#application-managed-process-engine

Cristian Mastrantono

unread,
Feb 26, 2015, 9:35:41 AM2/26/15
to camunda-...@googlegroups.com
Hi Thorben!

I just did what you suggested
  • Used a EmbeddedProcessApplication (InternalProcessApplication extends EmbeddedProcessApplication) --> @ProcessApplication(name="bpmengine",deploymentDescriptors={"bpmengine/processes.xml"}) with an empty "processes.xml"
  • I have a EngineBootstrapBean --> @Startup & @Singleton, with a startup method like this one below:
//pre configuration of engine.
ProcessEngineConfiguration pec = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
pec.setProcessEngineName("gobpm");
pec.setDataSourceJndiName("java:jboss/datasources/bpmengine");
pec.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE);
pec.setJobExecutorActivate(true);
pec.setAuthorizationEnabled(true);
pec.setHistory("full");

//build engine!
pec.buildProcessEngine();

// instantiate the process application
processApplication = new InternalProcessApplication();

// deploy the process application
processApplication.deploy();

Everything seems to work well, although now I'm facing a weird behavior when creating process instances:

  • Both process instance ID and Task ID, now are randomly Integers (like 110, 7, 19) while if I set the engine in process.xml (with EjbProcessApplication) process ids are hexa style (9a3f12ad-bdc1-11e4-9072-de4e20524153). is that ok? Will work the same with high load in both cases? What should I do to get the "hexa style" again?

In addition, I don't know how to configure the Job Executor programmatically... would you mind give some advice on this?

Thanks in advance for your help!
Cristian.

Christian Lipphardt

unread,
Feb 26, 2015, 10:52:27 AM2/26/15
to camunda-...@googlegroups.com
Hi Cristian,

You have to include a dependency in your project,
<dependency>
  <groupId>com.fasterxml.uuid</groupId>
  <artifactId>java-uuid-generator</artifactId>
  <version>3.1.2</version>
</dependency>
and then configure the engine to use it like:
   
    new StandaloneProcessEngineConfiguration().setIdGenerator(new org.camunda.bpm.engine.impl.persistence.StrongUuidGenerator());

The UUID generator is a optional transitive dependency (maven: provided scope), which is not propagated when including the engine.

Hint:
We recommend to import the camunda-bom so you do not have to be worried about correct versions of optional transitive dependencies.
<dependency>
  <groupId>org.camunda.bpm</groupId>
  <artifactId>camunda-bom</artifactId>
  <version>7.2.0</version>
</dependency>

To configure the JobExecutor programmatically , you can easily do:
DefaultJobExecutor jobExecutor = new DefaultJobExecutor();
jobExecutor.setCorePoolSize(10);
jobExecutor.setMaxPoolSize(100);
jobExecutor.setQueueSize(10);
standaloneProcessEngineConfiguration.setJobExecutor(jobExecutor);

Cheers,
Christian
signature.asc
Reply all
Reply to author
Forward
0 new messages