Giter Site home page Giter Site logo

zeeqs's Introduction

ZeeQS - Zeebe Query Service

License

Compatible with: Camunda Platform 8

A Zeebe community extension that provides a GraphQL query API over Zeebe's data. The data is imported from the broker using the Hazelcast exporter and aggregated in the service.

architecture view

๐Ÿš€ Install

Docker

The docker image is published to GitHub Packages .

Run the following command to start the application:

docker run -p 9000:9000 ghcr.io/camunda-community-hub/zeeqs:latest
  • Ensure that a Zeebe broker is running with a Hazelcast exporter
  • Forward the Hazelcast port to the docker container (default: 5701)
  • Configure the connection to Hazelcast (default: localhost:5701)
    • ZEEBE_CLIENT_WORKER_HAZELCAST_CONNECTION (environment variable)
    • zeebe.client.worker.hazelcast.connection (application.yaml)

Or, if you run it on your local machine (Linux only):

docker run --network="host" ghcr.io/camunda-community-hub/zeeqs:latest

After the application is started, the GraphQL endpoint is available under http://localhost:9000/graphql.

Go to http://localhost:9000/graphiql and explore the GraphQL API using GraphiQL.

Docker Compose

For a local setup, the repository contains a docker-compose file. It contains multiple profiles for different configurations.

Use an in-memory database (H2):

docker-compose --profile in-memory up

Use a PostgreSQL database:

docker-compose --profile postgres up

After the application is started, the GraphQL endpoint is available under http://localhost:9000/graphql.

Go to http://localhost:9000/graphiql and explore the GraphQL API using GraphiQL.

Configuration

By default, the API endpoint is available under the port 9000. And the database is only in-memory (i.e. not persistent).

To configure the application, look at the application.yml and the docker-compose file. See here on how to configure a Spring Boot application in general.

โœจ Usage

The application provides a GraphQL endpoint under /graphql.

You can query the API via HTTP POST request and a JSON body containing the query.

For example:

curl \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{ "query": "{ processes { nodes { key } } }" }' \
  http://localhost:9000/graphql

The best way to explore and inspect the GraphQL API is to use the integrated web-based tool GraphiQL. It is available under http://localhost:9000/graphiql.

Queries

The GraphQL API provides the following queries:

Example query

Query all processes including their number of process instances:

{
    processes {
        totalCount
        nodes {
            key
            bpmnProcessId
            version
            processInstances {
                totalCount
            }
        }
    }
}

Response:

{
  "data": {
    "processes": {
      "totalCount": 3,
      "nodes": [
        {
          "key": "2251799813685249",
          "bpmnProcessId": "demo-process",
          "version": 1,
          "processInstances": {
            "totalCount": 3
          }
        },
        {
          "key": "2251799813685251",
          "bpmnProcessId": "demo-2",
          "version": 1,
          "processInstances": {
            "totalCount": 2
          }
        },
        {
          "key": "2251799813685269",
          "bpmnProcessId": "demo-3",
          "version": 1,
          "processInstances": {
            "totalCount": 1
          }
        }
      ]
    }
  }
}

Pagination

In order to limit the response size and the query processing, each list query uses pagination to return only a subset of the data. By default, it returns the first 10 items of the list.

In addition to the items, the query result contains also the total count of the items.

{
    processes(perPage: 10, page: 0) {
        totalCount
        nodes {
            key
        }
    }
}

Filters

Some queries allow to filter the result by passing arguments in the query.

{
    processInstances(stateIn: [ACTIVATED]) {
        nodes {
            key
        }
    }
}

Subscriptions

The GraphQL API provides the following subscriptions:

The subscriptions are exposed via WebSockets over the same endpoint /graphql.

Example subscription

Subscribe to any updates of process instances:

subscription {
    processInstanceUpdates {
        processInstance {
            key
            state
        }
        updateType
    }
}

Response:

{
  "data": {
    "processInstanceUpdates": {
      "processInstance": {
        "key": "2251799813685251",
        "state": "ACTIVATED"
      },
      "updateType": "ELEMENT_INSTANCE"
    }
  }
}

Build from Source

Build with Maven

mvn clean install

Code of Conduct

This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Read more about the Camunda Community Code of Conduct and how to report unacceptable behavior.

License

Apache License, Version 2.0

zeeqs's People

Contributors

saig0 avatar dependabot[bot] avatar dependabot-preview[bot] avatar actions-user avatar salaboy avatar aivinog1 avatar strawhat5 avatar abhinav9512 avatar cameronbraid avatar daniel-shuy avatar celanthe avatar vctrmn avatar chaima-mnsr avatar lzgabel avatar skayliu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.