This service is used for business-process management. It's a Spring Boot application over Camunda Platform 7.
Business-process-management-service provides a set of components that extend Camunda API:
- ddm-bpm - central module with application configuration and main class
- ddm-bpm-api - main data-transfer objects that are used in ddm-bpm-client and ddm-bpm-rest.
- ddm-bpm-client - Feign clients for http cross-service integration.
- ddm-bpm-data-accessor - business-process variables management.
- ddm-bpm-engine - extending business-processes parsing and processing.
- ddm-bpm-extension - custom business-process extensions that implemented as ExecutionDelegates.
- ddm-bpm-history-event-handler - sending Camunda history events to external database.
- ddm-bpm-integration-tests - integration testing of whole application.
- ddm-bpm-metrics-plugin - plugin that adds business-process execution metrics in Prometheus.
- ddm-bpm-rest - extending Camunda REST API.
- ddm-bpm-security - managing camunda authentication and authorization for user.
- ddm-bpm-storage - managing form and file data in the storage during process execution.
As this service is designed to be used in Kubernetes in scope of a platform there described instruction only for usage for local development.
- Installed Java OpenJDK 11, Maven and Docker.
- Maven is configured to use Nexus repository with all needed dependencies.
NOTE: Using Java JDK with version higher than 11 may cause some runtime problems.
E.g. test TokenCacheServiceTest.java may fail on higher versions because of secp256k1 elliptic curve that is no longer supported.
- Configuration can be changed here application-local.yml.
- Any jvm attributes can be added to JAVA_OPTS environment variable in business-process-management-service in docker-compose.yml.
- In case if you don't need any service-mock or redis just delete it from docker-compose.yml.
- Build the service
mvn package
- Copy the application jar file to root project directory
cp ddm-bpm/target/ddm-bpm-1.9.0.jar target/
- Run Docker-compose
docker-compose up -d --scale redis-sentinel=3
NOTE: If one of the redis-sentinel was failed because of already bound port, then likely this port was bound by other redis-sentinel service. In that case just execute the docker-compose again. It may require up to 3 attempts.
- Go to http://localhost:8080/openapi to open services Swagger, or connect to localhost:5005 with remote debug.
- In case if you need to rebuild the service you also need to remove service docker image:
docker rmi bpms_business-process-management-service -f
To install the service with Kafka, it's needed to perform next steps before building the jar file:
- Enable Kubernetes on your docker: instruction.
- Deploy Strimzi by instruction on
Docker Desktop
tab. - DO NOT create an Apache Kafka cluster from Strimzi instructions, instead perform
next:
kubectl apply -f docker-local/kafka/kafka-cluster.yml -n kafka
- Install Kafka-ui (Optional):
- Install Helm
- Add helm repo:
helm repo add kafka-ui https://provectus.github.io/kafka-ui-charts
- Install kafka-ui to
kafka
namespace:helm install kafka-ui kafka-ui/kafka-ui \ --set envs.config.KAFKA_CLUSTERS_0_NAME=local \ --set envs.config.KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka-cluster-kafka-bootstrap:9092 \ --namespace kafka
- Port forward to Kafka-UI pod:
kubectl -n kafka port-forward svc/kafka-ui 8083:80
- Go to Kafka-UI
- Define what node port is used by kafka:
kubectl -n kafka get service kafka-cluster-kafka-external-bootstrap -o=jsonpath='{.spec.ports[0].nodePort}{"\n"}'
- In application-local.yml change:
data-platform.kafka.enabled: true
data-platform.kafka.bootstrap: docker-desktop:${NODE_PORT}
where ${NODE_PORT} is port defined in previous stepdata-platform.kafka.consumer.enabled: true
- Perform steps from Quick installation
- Generate JWT token for the service (e.g. here). The token must have
preferred_username claim. And use it in
Authorize
in Swagger.NOTE: by default service have no authorization in local profile. This is needed if business-process accesses user info or uses the token in integrations.
- Deploy executable business-process using POST /deployment
NOTE: tenant_id must be
null
so disable the checkboxSend empty value
if you're using Swagger. Also, file extension must be.bpmn
. In other case you won't see your process in the list of processes. - Start business-process using POST /process-definition/key/{key}/start where
key
is business-process-definition key defined in bpmn file. If your business-process requires start-form then it's needed to add required document to Redis first:- Go to http://localhost:8081/ and login username - root, password qwerty.
- Select local(redis-master:6379:0) and press
Add New Key...
- Set any
Key
, choose typeHash
. In fieldField
setdata
. And inValue
set needed json object. - Used
Key
is needed to pass as variable with namestart_form_ceph_key
in starting business-process request body.
- Mock every request that will be needed for business-process using Wiremock UI:
- Complete business-process tasks using POST /extended/task/{id}/complete where
id
is a task id which can be retrieved by selecting task list (/extended/task or /extended/task/lightweight). Every task will require to add corresponding document to Redis first:- Go to http://localhost:8081/ and login username - root, password qwerty.
- Select local(redis-master:6379:0) and press
Add New Key...
- In
Key
field set valuebpm-form-submissions:process/{processInstanceId}/task/{taskDefinitionKey}
whereprocessInstanceId
is an id of current process-instance andtaskDefinitionKey
is key of the task defined in bpmn file. - Choose type
Hash
. In fieldField
setdata
. And inValue
set needed json object.
- Stop the docker-compose if it's running:
docker-compose stop
- Run verify on maven:
mvn verify
- On Mac it can asc for accepting incoming network connections to redis-server app.
Click
Accept
.
The ddm-bpm-parent is Open Source software released under the Apache 2.0 license.