Flowable Spring Boot Microservice integration with Flowable UI

Hi,

We have created a Spring Boot microservice using flowable engine with custom services according to our business requirements.
The flowable application uses an Oracle Database for its tables.
We have a separate UI which interacts with our service through REST calls and hence there was no need for a flowable UI.
I am given to understand that flowable task has a UI which shows us in which stage a workflow is currently. But for this the workflow has to be initiated/managed through the flowable UI.
Since ours is a microservice, is it possible to using the existing workflows created by our API and displaying it in the flowable task window or such a UI where the process can be viewed?

How much interaction do you want to have with the processes? Is this more of an “administrator” view? Flowable-Admin can be pointed at any flowable instance that has the flowable-rest endpoints available. This will give you visibility into the engines and admin features like the ability to change states, cancel processes, etc.

Hi wwitt,

Thanks for prompt reply.
Currently we have a rest api which uses an oracle database. However we need a UI for visualization of the processes and its states.
So is it possible to view this UI by simply pointing the Flowable-Admin to the oracle db used by our api?

No, Flowable-Admin has a database connection for its own use, but can only get information about the engines via REST interfaces. If you are not using Flowable’s REST endpoints (by including the flowable-rest dependency) you can stand up another instance of the engine that does and point it at the same database. Since you’d only be using that instance for monitoring, you’ll want to ensure you turn off the async executor on it to avoid trying to run async tasks on it.

Why not give it a try?

In this post, I’ll walk you through the steps I followed to create a RESTful API (Resource Server) that embeds Flowable’s BPMN engine, exposes the BPMN engine’s RESTful API and leverages Spring Security’s support for OAuth 2.0 and Jason Web Tokens (JWTs).

Ref: Flowable OAuth2 Resource Server

Flowable UI Applications

  • Flowable Identity Management
  • Flowable Modeler
  • Flowable Task
  • Flowable Admin

You can download the Flowable open source distribution from the Flowable web site.

Externalised Configuration

The Flowable Web applications take advantage of Spring Boot’s support for externalised configuration:

spring.main.banner-mode=off

# Logging
logging.level.root=INFO
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
logging.level.org.springframework.security=DEBUG

# Spring JPA
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.url=jdbc:h2:~/serendipity-db/db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9091;DB_CLOSE_DELAY=-1
spring.datasource.username=admin
spring.datasource.password=secret
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
# spring.jpa.hibernate.ddl-auto=create-drop
# spring.jpa.hibernate.ddl-auto=none

# H2 Console
spring.h2.console.enabled=false
spring.h2.console.path=/h2-console
spring.h2.console.settings.trace=false
spring.h2.console.settings.web-allow-others=false

# Default Admin Accounts
flowable.idm.app.admin.user-id=flowable
flowable.idm.app.admin.password=secret
flowable.idm.app.admin.first-name=
flowable.idm.app.admin.last-name=Administrator
flowable.idm.app.admin.email=admin@serendipity.org.au

flowable.common.app.idm-admin.user=flowable
flowable.common.app.idm-admin.password=secret

flowable.modeler.app.deployment-api-url=http://localhost:9999/flowable-task/app-api

# LDAP
flowable.idm.ldap.enabled=true
flowable.idm.ldap.server=ldap://localhost
flowable.idm.ldap.port=10389
flowable.idm.ldap.user=cn=admin,dc=flowable,dc=org
flowable.idm.ldap.password=secret
flowable.idm.ldap.base-dn=dc=flowable,dc=org
flowable.idm.ldap.user-base-dn=ou=users,dc=flowable,dc=org
flowable.idm.ldap.group-base-dn=ou=groups,dc=flowable,dc=org
flowable.idm.ldap.query.user-by-id=(&(objectClass=inetOrgPerson)(uid={0}))
flowable.idm.ldap.query.user-by-full-name-like=(&(objectClass=inetOrgPerson)(|({0}=*{1}*)({2}=*{3}*)))
flowable.idm.ldap.query.all-users=(objectClass=inetOrgPerson)
flowable.idm.ldap.query.groups-for-user=(&(objectClass=groupOfUniqueNames)(uniqueMember={0}))
flowable.idm.ldap.query.all-groups=(objectClass=groupOfUniqueNames)
flowable.idm.ldap.query.group-by-id=(&(objectClass=groupOfUniqueNames)(uniqueId={0}))
flowable.idm.ldap.attribute.user-id=uid
flowable.idm.ldap.attribute.first-name=cn
flowable.idm.ldap.attribute.last-name=sn
flowable.idm.ldap.attribute.email=mail
flowable.idm.ldap.attribute.group-id=cn
flowable.idm.ldap.attribute.group-name=cn
flowable.idm.ldap.cache.group-size=10000
flowable.idm.ldap.cache.group-expiration=180000

Flowable Identity Management

To launch Flowable’s Identity Management application:

java -jar flowable-idm.war

Then navigate to: http://localhost:8080/flowable-idm

Flowable Modeler

To launch Flowable’s Modeler application:

java -jar flowable-modeler.war

Then navigate to: http://localhost:8888/flowable-modeler

Flowable Task

To launch Flowable’s Task application:

java -jar flowable-task.war

Then navigate to: http://localhost:9999/flowable-task

Flowable Admin

To launch Flowable’s Admin application:

java -jar flowable-admin.war

Then navigate to: http://localhost:9988/flowable-admin

Source Code:
References:

Hi,
Sorry if i am not able to explain our scenario properly.
Simply put we have a spring boot code which uses flowable dependencies. All the interactions of starting a workflow, completing a task etc are done by service calls. Hence there is no UI where we can show the current stage of workflow or task.
Hence we were looking for such a solution.

Hi…I found an endpoint for admin - http://rest-admin:test@localhost:8080/flowable-rest/service/runtime/process-instances/{processInstanceId}/diagram and this is what we are looking for.
Is there a way we can generate this diagram via our flowable application without the need of flowable-admin?

After a few minutes of digging I found an api inside
org.flowable
flowable-rest
which contained the class ProcessDiagramGenerator which did the trick for generating a diagram for a given processInstanceId.

1 Like

This should do it.

ProcessDefinition pde = repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());
BpmnModel bpmnModel = repositoryService.getBpmnModel(pde.getId());
ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
InputStream resource = diagramGenerator.generateDiagram(bpmnModel, “png”,
runtimeService.getActiveActivityIds(processInstance.getId()), Collections.emptyList(),
processEngineConfiguration.getActivityFontName(), processEngineConfiguration.getLabelFontName(),
processEngineConfiguration.getAnnotationFontName(), processEngineConfiguration.getClassLoader(), 1.0, true);

1 Like

Yes.
This is what i ended up using.

But this solution will show only the current status of the process instance. Is there any possibility to show the path it traversed also in the diagram like “Show process diagram” in admin app.
Thanks in advance…

It looks like the rendering is done on the client side: when I look at the HTTP requests in the Task App, I see that it is actually JSON that is sent back to the browser (with the coordinates, sizes AND the status of the elements)