REST API which can fetch Workflow status and its variables

Hi team,

Hope you are doing well, i have a requirement where i have to build a REST API which can fetch workflow instance status and workflow instance variables and send it as response. Is it possible to acieve this or any other alternative solution.

You can do it via the exporter interface.
Ready to use Elasticsearch exporter stores all the data you need to get everything.
But I found more convenient is to implement our own exporter which does not store the raw events but accumulates and updates the data describing the state of the process instances including variables.

3 Likes

Hi @jetdream,

Thank you so much for quick update, Actually im new to zeebe and im not aware of configurations in depth. So can u please help with the configurations to export the data into elastic search and achieve the requirement.

docker-compose.yml

version: “2”

networks:
zeebe_network:
driver: bridge

services:
zeebe:
container_name: zeebe_broker
image: camunda/zeebe:0.23.1
environment:
- ZEEBE_LOG_LEVEL=info
ports:
- “26500:26500”
- “9600:9600”
- “5701:5701”
volumes:
- …/lib/zeebe-hazelcast-exporter.jar:/usr/local/zeebe/exporters/zeebe-hazelcast-exporter.jar
- ./application.yaml:/usr/local/zeebe/config/application.yaml
networks:
- zeebe_network
monitor:
container_name: zeebe_monitor
image: camunda/zeebe-simple-monitor:0.18.0
environment:
- zeebe.client.broker.contactPoint=zeebe:26500
- zeebe.worker.hazelcast.connection=zeebe:5701
volumes:
- ./simple-monitor-application.yaml:/usr/local/zeebe/config/application.yaml
ports:
- “8082:8082”
depends_on:
- zeebe
networks:
- zeebe_network

Application.yaml

zeebe:
broker:
exporters:
hazelcast:
className: io.zeebe.hazelcast.exporter.HazelcastExporter
jarPath: exporters/zeebe-hazelcast-exporter.jar
# elasticsearch:
# className: io.zeebe.exporter.ElasticsearchExporter
# args:
# url: http://localhost:9200

        # bulk:
            # delay: 5
            # size: 1000
        # authentication:
            # username: elastic
            # password: changeme

        # index:
            # prefix: zeebe-record
            # createTemplate: true

            # command: false
            # event: true
            # rejection: false
            # deployment: true
            # error: true
            # incident: true
            # job: true
            # jobBatch: false
            # message: false
            # messageSubscription: false
            # variable: true
            # variableDocument: true
            # workflowInstance: true
            # workflowInstanceCreation: false
            # workflowInstanceSubscription: false
            # ignoreVariablesAbove: 32677

simple-monitor-application.yaml

zeebe:
worker:
hazelcast:
connection: zeebe:5701

client:
broker.contactPoint: zeebe:26500
security.plaintext: true

spring:
datasource:
url: jdbc:h2:mem:zeebe-monitor;DB_CLOSE_DELAY=-1
user: sa
password:
driverClassName: org.h2.Driver

jpa:
database-platform: org.hibernate.dialect.H2Dialect
hibernate:
ddl-auto: update

server:
port: 8082

Hey @Tauqeer
In your Application.yaml I see Elesticsearch exporter is disabled (commented)

You can find ready-to-use docker-compose with ES here