Autoretry incidents by code

Hi, in Camunda 7 I used this code for auto retry incidents. Is any similar way how to do that in platform 8? I need to get ALL incidents from database try to run them again. Thanks

try (
                Stream<Incident> incidentStream = runtimeService.createIncidentQuery()
        ) {


                    incidentRecord -> {
              "Retry of process instance {} task {}",
                                incidentRecord.getProcessInstanceId(), incidentRecord.getFailedActivityId());
                        String activityId = incidentRecord.getFailedActivityId();incidentRecord.getFailedActivityId(), incidentRecord.getProcessDefinitionId());
                        if (!activityId.isEmpty())
    private void autoRetry(List<String> ids) {
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        processEngine.getManagementService().setJobRetries(ids, 1);

Hi @milousel - I believe this API call is the one you’re looking for:

Thank you a lot. Can you also tell me how to generate bearer token in self managed mode? I run in my local docker environment docker-compose-core.yaml.

@milousel - if you’re using the docker-compose-core configuration, it uses basic authentication only. To use OAuth/OIDC flows, you need to use Identity. For that particular configuration, it defaults to a username of demo/demo.

So can you please tell me what I doing wrong? I add basic authorization as you said, but I still receive code 401. I let default username and password.

public void getAllIncidents() throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder()
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "{}");
        Request request = new Request.Builder()
                .method("POST", body)
                .addHeader("Content-Type", "application/json")
                .addHeader("Accept", "application/json")
                .addHeader(HttpHeaders.AUTHORIZATION, Credentials.basic("demo", "demo"))
                //.addHeader("Authorization", "Bearer <TOKEN>")
                .build();"http request: {}", request);
        Response response = client.newCall(request).execute();"response: {}", response);


Response{protocol=http/1.1, code=401, message=, url=http://localhost:8081/v1/incidents/search}

Hi @milousel - I don’t have an example for Operate off-hand, but this library shows the same basic authentication against Tasklist: GitHub - camunda-community-hub/camunda-tasklist-client-java: Java client for the Tasklist API of Camunda Platform 8 - and you can view an implementation example using that library here: camunda-deep-dives/tasklist-client-examples at main · upgradingdave/camunda-deep-dives · GitHub

tried to rewrite it by your example, but it is not still working. Can please try to find what I doing wrong? Thank you a lot of.

SimpleConfig simpleConf = new SimpleConfig();
        simpleConf.addProduct(Product.OPERATE, new SimpleCredential("demo", "demo"));
        Authentication auth = SimpleAuthentication.builder().simpleConfig(simpleConf).build();
        CamundaOperateClient client = CamundaOperateClient.builder().operateUrl("http://localhost:8081").authentication(auth).build();
        List<Incident> incidentList = client.searchIncidents(new SearchQuery());"incidents: {}", incidentList);


java.lang.NullPointerException: Cannot invoke “, java.lang.Class,, Object)” because “this.httpClient” is null
at io.camunda.operate.CamundaOperateClient.searchIncidentResults( ~[java-client-operate-8.4.0.jar:8.4.0]
at io.camunda.operate.CamundaOperateClient.searchIncidents( ~[java-client-operate-8.4.0.jar:8.4.0]
at com.camunda.eight.demo.service.impl.CamundaServiceImpl.getAllIncidents( ~[classes/:na]

Hi @milousel - I have only done API work using Identity and OAuth, so I don’t have any practical experience to help with here. Perhaps these docs help?

I finally find a solution how to connect to self-manage Operate with simpleCredential:

SimpleConfig simpleConf = new SimpleConfig();
        simpleConf.addProduct(Product.OPERATE, new SimpleCredential("demo", "demo"));
        Authentication auth = SimpleAuthentication.builder().simpleUrl("http://localhost:8081").simpleConfig(simpleConf).build();
        CamundaOperateClient client = CamundaOperateClient.builder().operateUrl("http://localhost:8081").authentication(auth).setup().build();

But I still have a question if is it possibe to invoke autoretry of incident by CamundaOperateClient?