Missing global event listener

Hi,
I start working with Camunda 8. In my last application where I used Camunda 7 I used global @EventListener for tracking all changes in processes like finish service tasks, assing user task etc. Now in Camunda 8 I need to use something similar, but from internet I read that in C8 does not exist event listeners. So my question is if there is any option how to solve this problem for tracking changes in processes in real time like in C7. Thanks

Hi @milousel - you are correct, that same concept does not exist in C8. You could implement a custom exporter and monitor the event stream (this is only an option for Self Managed instances, not SaaS). Depending on what you need to track and why, there may be other options as well.

Hi,
I need to sending notifications about any change in process to another systems in real time.

Hi @milousel - why do those applications need to know the exact real-time status of every process? Camunda 8 is an entirely different architecture than C7, which requires rethinking some solutions (not all, just some). Zeebe is a fully asynchronous, cloud-native workflow engine compared to C7’s very synchronous embedded behaviors.

  • can the applications query the API to get the status of a process when needed?
  • can the status updates be modeled explicitly in your BPMN diagram?

Hi @nathan.loding thanks for your answer. I need it for changing “status” of each running process in another systems. I think that some “smaller” delay is ok, but still I need to know when process move from one step to another / when task was claim etc. So just calling some API for each running instance is not ideal solution for my problem. Do you know about another way?

Hi @milousel - if you can’t model it explicitly, and you truly need that information as immediately as possible via a push mechanism, than a custom exporter is your best approach I believe.

Hi,
thanks for your answer. I tried to write simple incident exporter, but I need some little help. When I try to run Camunda via docker-compose-core.yaml on local machine Zeebe fails. I will copy below only Zeebe part from docker-compose file, I only change “volumes” section where I added .toml and .jar files. Do you see some trouble in my code / settings? Thanks for any help.

zeebe docker logs

2024-03-25 09:30:19 + hostname -i
2024-03-25 09:30:19 + HOST=172.26.0.3
2024-03-25 09:30:19 + [ false = true ]
2024-03-25 09:30:19 + [ false = true ]
2024-03-25 09:30:19 + export ZEEBE_BROKER_NETWORK_HOST=172.26.0.3
2024-03-25 09:30:19 + export ZEEBE_BROKER_GATEWAY_CLUSTER_HOST=172.26.0.3
2024-03-25 09:30:19 + exec /usr/local/zeebe/bin/broker
2024-03-25 09:30:19 Picked up JAVA_TOOL_OPTIONS: -Xms512m -Xmx512m
2024-03-25 09:30:19 Error: Could not find or load main class io.camunda.zeebe.broker.StandaloneBroker
2024-03-25 09:30:19 Caused by: java.lang.ClassNotFoundException: io.camunda.zeebe.broker.StandaloneBroker

java exporter

public class IncidentAlerter implements Exporter
{
    private Controller controller;
    private ZeebeClient client;
    private Logger log;

    @Override
    public void configure(Context context) throws Exception {
        RecordFilter filter = new RecordFilter();
        context.setFilter(filter);
        this.log = context.getLogger();
    }

    @Override
    public void open(Controller controller) {
        this.controller = controller;
        this.client = ZeebeClient.newClientBuilder()
                        .usePlaintext()
                        .gatewayAddress("127.0.0.1:26500")
                        .build();
    }

    @Override
    public void close() {
        client.close();
    }

    @Override
    public void export(Record<?> record) {
        log.info("record: {}", record);
        this.controller.updateLastExportedRecordPosition(record.getPosition());
    }
}

zeebe.cfg.toml

[[exporters]]
id = "incidents"
className = "io.zeebe.IncidentAlerter"

docker-compose-core.yml

zeebe:
    # https://docs.camunda.io/docs/self-managed/platform-deployment/docker/#zeebe
    image: camunda/zeebe:${CAMUNDA_PLATFORM_VERSION}
    container_name: zeebe
    ports:
      - "26500:26500"
      - "9600:9600"
    environment:
      # https://docs.camunda.io/docs/self-managed/zeebe-deployment/configuration/environment-variables/
      - ZEEBE_BROKER_EXPORTERS_ELASTICSEARCH_CLASSNAME=io.camunda.zeebe.exporter.ElasticsearchExporter
      - ZEEBE_BROKER_EXPORTERS_ELASTICSEARCH_ARGS_URL=http://elasticsearch:9200
      # default is 1000, see here: https://github.com/camunda/zeebe/blob/be49f5d63a666cf1f4a7f5d731dc737404053ded/exporters/elasticsearch-exporter/src/main/java/io/camunda/zeebe/exporter/ElasticsearchExporterConfiguration.java#L259
      - ZEEBE_BROKER_EXPORTERS_ELASTICSEARCH_ARGS_BULK_SIZE=1
      # allow running with low disk space
      - ZEEBE_BROKER_DATA_DISKUSAGECOMMANDWATERMARK=0.998
      - ZEEBE_BROKER_DATA_DISKUSAGEREPLICATIONWATERMARK=0.999
      - "JAVA_TOOL_OPTIONS=-Xms512m -Xmx512m"
    restart: always
    healthcheck:
      test:
        [
          "CMD-SHELL",
          "timeout 10s bash -c ':> /dev/tcp/127.0.0.1/9600' || exit 1"
        ]
      interval: 30s
      timeout: 5s
      retries: 5
      start_period: 30s
    volumes:
      - .zeebe.cfg.toml:/usr/local/zeebe/conf/zeebe.cfg.toml
      - .zeebe-exporter-demo-3.3.0-SNAPSHOT.jar:/usr/local/zeebe/lib/
      - zeebe:/usr/local/zeebe/data
    networks:
      - camunda-platform
    depends_on:
      - elasticsearch

I’m not even 50% up to speed on this yet, but I think that your JAR import is overwriting the whole of the /usr/local/zeebe/lib directory with this configuration.

Try it like:

    volumes:
      - .zeebe.cfg.toml:/usr/local/zeebe/conf/zeebe.cfg.toml
      - .zeebe-exporter-demo-3.3.0-SNAPSHOT.jar:/usr/local/zeebe/lib/zeebe-exporter-demo-3.3.0-SNAPSHOT.jar
      - zeebe:/usr/local/zeebe/data
1 Like