Giter Site home page Giter Site logo

camunda-community-hub / micronaut-zeebe-client Goto Github PK

View Code? Open in Web Editor NEW
26.0 14.0 8.0 575 KB

This open source project allows you to easily implement Zeebe Worker with Micronaut: simply add a dependency in your Micronaut project

Home Page: https://www.novatec-gmbh.de/en/blog/bringing-cloud-native-process-automation-to-micronaut/

License: Apache License 2.0

Java 100.00%
java workflow bpm graalvm hacktoberfest camunda zeebe-worker zeebe micronaut micronaut-framework

micronaut-zeebe-client's Introduction

micronaut-zeebe-client

Release License Continuous Integration GitHub Discussions

Compatible with: Camunda Platform 8

This open source project allows you to implement a Zeebe client with the Micronaut Framework. You can connect to Camunda Platform 8 (previously Camunda Cloud) or your self-managed Zeebe Cluster.

With this integration you can implement a Zeebe job worker with minimal boilerplate code to process tasks. Additionally, you can use the client to deploy process models, and start and cancel process instances.

The Micronaut Framework is known for its efficient use of resources. If you use GraalVM you have startup times of about 35ms!

The integration is preconfigured with sensible defaults, so that you can get started with minimal configuration: simply add a dependency and your Camunda Platform 8 credentials in your Micronaut project!

If you are interested in using Camunda Platform on a Micronaut application instead, have a look at our open source project micronaut-camunda-bpm.


We're not aware of all installations of our Open Source project. However, we love to

  • listen to your feedback,
  • discuss possible use cases with you,
  • align our roadmap to your needs!

📨 Please contact us!


Do you want to try it out? Please jump to the Getting Started section.

Do you want to contribute to our open source project? Please read the Contribution Guidelines and contact us.

Micronaut Framework + Camunda Platform 8 = ❤️

Table of Contents

✨Features

  • Camunda external client can be integrated by simply adding a dependency to your project.
  • A worker can subscribe to multiple topics.
  • The worker's external task client can be configured with properties.

🚀Getting Started

This section describes what needs to be done to use micronaut-zeebe-client-feature in a Micronaut project.

Dependency Management

The Zeebe integration works with both Gradle and Maven, but we recommend using Gradle because it has better Micronaut Support.

You have the following options to integrate the Zeebe integration:

  • Create a new Micronaut project using Micronaut Launch and check that the "camunda-zeebe" feature is selected.

  • Manually add the dependency to a Micronaut project:

    Click to show Gradle configuration

    Add the dependency to the build.gradle file:

    implementation("info.novatec:micronaut-zeebe-client-feature:1.17.0")
    Click to show Maven configuration

    Add the dependency to the pom.xml file:

    <dependency>
      <groupId>info.novatec</groupId>
      <artifactId>micronaut-zeebe-client-feature</artifactId>
      <version>1.17.0</version>
    </dependency>
    <!-- workaround for https://github.com/camunda-community-hub/micronaut-zeebe-client/issues/88 -->
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>3.19.3</version>
    </dependency>

Note: The module micronaut-zeebe-client-feature includes the dependency io.camunda:zeebe-client-java which will be resolved transitively.

Creating a Client

The minimal configuration requires you to provide a handler for a specific topic. You can register multiple handlers in this way for different topics.

On start of the application the external task client will automatically connect to Zeebe and start fetching tasks.

Option 1: Annotate Method

To register a handler you can annotate a method with ZeebeWorker.

Example handler:

import info.novatec.micronaut.zeebe.client.feature.ZeebeWorker;
import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.client.api.worker.JobClient;
import jakarta.inject.Singleton;

@Singleton
public class ExampleHandler {

    @ZeebeWorker(type = "my-type")
    public void doSomething(JobClient client, ActivatedJob job) {
        // Put your business logic here
        
        client.newCompleteCommand(job.getKey()).send()
          .exceptionally( throwable -> { throw new RuntimeException("Could not complete job " + job, throwable); });
    }
}

Option 2: Annotate Class

To register a handler you can annotate a class implementing the JobHandler interface with ZeebeWorker.

Example handler:

import info.novatec.micronaut.zeebe.client.feature.ZeebeWorker;
import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.client.api.worker.JobClient;
import io.camunda.zeebe.client.api.worker.JobHandler;
import jakarta.inject.Singleton;

@Singleton
@ZeebeWorker(type = "my-type")
public class ExampleHandler implements JobHandler {

    @Override
    public void handle(JobClient client, ActivatedJob job) {
        // Put your business logic here
        
        client.newCompleteCommand(job.getKey()).send()
          .exceptionally( throwable -> { throw new RuntimeException("Could not complete job " + job, throwable); });
    }
}

ZeebeWorker Annotation

The annotation accepts the following properties, more will be added later:

Property Description
type The mandatory the type of jobs to work on.
timeout The optional time for how long a job is exclusively assigned for this worker, e.g "PT15M"
maxJobsActive The optional maximum number of jobs which will be exclusively activated for this worker at the same time.
requestTimeout The optional request timeout for activate job request used to poll for new job, e.g. PT20S.
pollInterval The optional maximal interval between polling for new jobs, e.g. PT0.1S for 100ms.

Note: If no value is provided for an optional property then the default will be taken from the configuration as documented below.

Configuration

You may use the following properties (typically in application.yml) to configure the Zeebe client.

Prefix Property Default Description
zeebe.client.cloud .cluster-id The cluster ID when connecting to Camunda Platform 8. Don't set this for a local Zeebe Broker.
.client-id The client ID to connect to Camunda Platform 8. Don't set this for a local Zeebe Broker.
.client-secret The client secret to connect to Camunda Platform 8. Don't set this for a local Zeebe Broker.
.region bru-2 The region of the Camunda Platform 8 cluster.
.gateway-address 0.0.0.0:26500 The gateway address if you're not connecting to Camunda Platform 8. Must be in format host:port.
.use-plain-text-connection true Whether to use plain text or a secure connection. This property is not evaluated if connecting to Camunda Platform 8 because that will always use a secure connection.
.default-request-timeout PT20S The request timeout used if not overridden by the command.
.default-job-poll-interval 100 The interval which a job worker is periodically polling for new jobs.
.default-job-timeout PT5M The timeout which is used when none is provided for a job worker.
.default-message-time-to-live PT1H The time-to-live which is used when none is provided for a message.
.default-job-worker-name default The name of the worker which is used when none is set for a job worker.
.num-job-worker-execution-threads 1 The number of threads for invocation of job workers. Setting this value to 0 effectively disables subscriptions and workers.
.keep-alive PT45S Time interval between keep alive messages sent to the gateway.
.ca-certificate-path default store Path to a root CA certificate to be used instead of the certificate in the default keystore.

Examples

Here are some example applications:

Supported JDKs

The current releases are built with Micronaut 4 and therefore we officially support the following JDKs:

  • JDK 17 (LTS)
  • JDK 21 (LTS)

The lastest release supporting Micronaut 3 is 1.15.0 which supports the following JDKs:

  • JDK 8 (LTS)
  • JDK 11 (LTS)
  • JDK 17 (LTS)

🏆Advanced Topics

Process Tests

Process tests can be implemented with JUnit 5 and JDK 11 and newer by adding the Zeebe Process Test library as a dependency:

Click to show Gradle dependencies
testImplementation("io.camunda:zeebe-process-test:1.3.0")
Click to show Maven dependencies
<dependency>
  <groupId>io.camunda</groupId>
  <artifactId>zeebe-process-test</artifactId>
  <version>1.3.0</version>
  <scope>test</scope>
</dependency>

and then implement the unit test with the @ZeebeProcessTest but without the @MicronautTest annotation:

import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.client.api.response.ActivateJobsResponse;
import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.client.api.response.DeploymentEvent;
import io.camunda.zeebe.client.api.response.ProcessInstanceEvent;
import io.camunda.zeebe.process.test.assertions.BpmnAssert;
import io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert;
import io.camunda.zeebe.process.test.extensions.ZeebeProcessTest;
import io.camunda.zeebe.process.test.testengine.InMemoryEngine;
import io.camunda.zeebe.process.test.testengine.RecordStreamSource;
import org.junit.jupiter.api.Test;

@ZeebeProcessTest
class ProcessTest {

  InMemoryEngine engine;
  ZeebeClient client;
  @SuppressWarnings("unused")
  RecordStreamSource recordStreamSource;

  @Test
  void workerShouldProcessWork() {

    // Deploy process model
    DeploymentEvent deploymentEvent = client.newDeployCommand()
            .addResourceFromClasspath("bpmn/say_hello.bpmn")
            .send()
            .join();

    BpmnAssert.assertThat(deploymentEvent);

    // Start process instance
    ProcessInstanceEvent event = client.newCreateInstanceCommand()
            .bpmnProcessId("Process_SayHello")
            .latestVersion()
            .send()
            .join();

    engine.waitForIdleState();

    // Verify that process has started
    ProcessInstanceAssert processInstanceAssertions = BpmnAssert.assertThat(event);
    processInstanceAssertions.hasPassedElement("start");
    processInstanceAssertions.isWaitingAtElement("say_hello");

    // Fetch job: say-hello
    ActivateJobsResponse response = client.newActivateJobsCommand()
            .jobType("say-hello")
            .maxJobsToActivate(1)
            .send()
            .join();

    // Complete job: say-hello
    ActivatedJob activatedJob = response.getJobs().get(0);
    client.newCompleteCommand(activatedJob.getKey()).send().join();
    engine.waitForIdleState();

    // ...

    // Verify completed
    engine.waitForIdleState();
    processInstanceAssertions.isCompleted();
  }
}

See also a test in our example application: ProcessTest

Monitoring

Adding a health endpoint for monitoring purposes in a cloud environment can be achieved by adding the dependency:

runtimeOnly 'io.micronaut:micronaut-management'

The health endpoint can be retrieved by calling GET on /health

NOTE: If you don't need a health endpoint you can safely remove the runtime dependency runtime("netty") from your project. The application will then run as a CLI application without the embedded server.

GraalVM

With GraalVM you can reduce start-up time and memory usage even more! For example, on a developer environment the start-up time will drop to about 35ms!

The following instructions are based on macOS - other operating systems will probably be similar. Feel free to create a pull request with updated instructions for other operating systems.

Initial Setup

Install the gu executable to be able to install native-image based on instructions: https://www.graalvm.org/docs/getting-started/macos/ which links to https://github.com/graalvm/graalvm-ce-builds/releases/latest

tar -xvf graalvm-ce-java17-darwin-amd64-21.3.0.tar.gz
sudo mv graalvm-ce-java17-21.3.0 /Library/Java/JavaVirtualMachines
/usr/libexec/java_home -V
sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-ce-java17-21.3.0
export PATH=/Library/Java/JavaVirtualMachines/graalvm-ce-java17-21.3.0/Contents/Home/bin:$PATH
gu install native-image
native-image --version

Install GraalVM

Install GraalVM using SDKMAN!:

curl -s "https://get.sdkman.io" | bash
sdk install java 21.3.0.r17-grl

Initialize Environment

sdk use java 21.3.0.r17-grl
export PATH=/Library/Java/JavaVirtualMachines/graalvm-ce-java17-21.3.0/Contents/Home/bin:$PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java17-21.3.0/Contents/Home

Create Reflection Configuration

cd micronaut-zeebe-client-example
../gradlew clean build
mkdir -p src/main/resources/META-INF/native-image
java -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image/ -jar build/libs/micronaut-zeebe-client-example-0.0.1-SNAPSHOT-all.jar

Start the server with the provided docker-compose.yml and cancel the client with Ctrl-C once you see that the client is running when it repeatedly logs like Retrieved value 37. Goodbye, from job 4503599627392427.

Build Image

The generated reflect-config.json misses three entries (why?) which we add manually:

{
  "name":"io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider",
  "queryAllPublicMethods":true,
  "methods":[{"name":"<init>","parameterTypes":[] }]
},
{
  "name":"io.grpc.internal.PickFirstLoadBalancerProvider",
  "queryAllPublicMethods":true,
  "methods":[{"name":"<init>","parameterTypes":[] }]
},
{
  "name":"io.grpc.internal.DnsNameResolverProvider",
  "queryAllPublicMethods":true,
  "methods":[{"name":"<init>","parameterTypes":[] }]
},

Now build the native image - note: this will take a few minutes:

../gradlew clean nativeCompile

Start Native Client

You can then start the external client (Note: Server must be running):

build/native/nativeCompile/micronaut-zeebe-client-example

The application will be up and processing the first tasks in about 35ms (!):

INFO  io.micronaut.runtime.Micronaut - Startup completed in 33ms. Server Running: http://localhost:8087
INFO  i.n.m.z.c.example.GreetingHandler - Hello world, from job 2251799813709648
INFO  io.camunda.zeebe.client.job.poller - Activated 1 jobs for worker default and job type say-hello
INFO  i.n.m.z.c.example.GoodbyeHandler - Retrieved value 18. Goodbye, from job 2251799813709653
INFO  io.camunda.zeebe.client.job.poller - Activated 1 jobs for worker default and job type say-goodbye
INFO  i.n.m.z.c.example.GreetingHandler - Hello world, from job 4503599627394811
INFO  io.camunda.zeebe.client.job.poller - Activated 1 jobs for worker default and job type say-hello

📚Releases

The list of releases contains a detailed changelog.

We use Semantic Versioning.

The following compatibility matrix shows the officially supported Micronaut and Zeebe versions for each release. Other combinations might also work but have not been tested.

Release Micronaut Framework Zeebe
1.17.0 4.3.4 8.4.4
Click to see older releases
Release Micronaut Framework Zeebe
1.16.0 4.1.0 8.3.3
1.15.0 3.9.4 8.2.1
1.14.0 3.9.0 8.2.1
1.13.0 3.9.0 8.1.6
1.12.0 3.8.9 8.1.6
1.11.0 3.8.0 8.1.5
1.10.0 3.7.1 8.1.0
1.9.0 3.6.1 8.0.5
1.8.0 3.5.2 8.0.3
1.7.0 3.4.1 8.0.0
1.6.0 3.4.0 1.3.5
1.5.0 3.4.0 1.3.5
1.4.1 3.3.4 1.3.5
1.4.0 3.3.0 1.3.2
1.3.1 3.3.0 1.3.2
1.3.0 3.3.0 1.3.1
1.2.2 3.2.7 1.3.1
1.2.1 3.2.7 1.3.1
1.2.0 3.2.6 1.3.0
1.1.1 3.2.3 1.2.7
1.1.0 3.2.0 1.2.4
1.0.1 3.1.3 1.2.4
1.0.0 3.1.0 1.2.2
0.0.1 3.0.2 1.1.3

Download of Releases:

📆Publications

📨Contact

If you have any questions or ideas feel free to create an issue or contact us via GitHub Discussions.

We love listening to your feedback, and of course also discussing the project roadmap and possible use cases with you!

This open source project is being developed by envite consulting GmbH and Novatec Consulting GmbH with the support of the open source community.


envite consulting GmbH envite consulting GmbH

Novatec Consulting GmbH

micronaut-zeebe-client's People

Contributors

dependabot[bot] avatar itsmestefanjay avatar lwluc avatar mustaphazorgati avatar renovate[bot] avatar saw303 avatar sdelamo avatar tobiasschaefer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

micronaut-zeebe-client's Issues

zeebe-client breaks when used with micronaut-management

Issue: adding io.micronaut:micronaut-management as a dependency breaks the app

`15:11:24: Executing task 'run'...

Task :compileJava UP-TO-DATE
Task :processResources UP-TO-DATE
Task :classes UP-TO-DATE

Task :run FAILED


| / () ___ _ __ ___ _ __ __ _ _ | |
| |/| | |/ | '/ _ | '
\ / ` | | | | |
| | | | | (
| | | (
) | | | | (| | || | |_
|| |||___|| ___/|| ||_,|_,|__|
Micronaut (v3.2.7)

15:11:26.422 [main] INFO i.n.m.z.c.feature.ZeebeClientFactory - ZeebeClient is configured to connect to gateway: 0.0.0.0:26500
15:11:26.455 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Bean definition [info.novatec.micronaut.zeebe.client.feature.ZeebeWorkerSubscriptionCreator] could not be loaded: Error instantiating bean of type [info.novatec.micronaut.zeebe.client.feature.ZeebeWorkerSubscriptionCreator]: io/micronaut/jdbc/DataSourceResolver
io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [info.novatec.micronaut.zeebe.client.feature.ZeebeWorkerSubscriptionCreator] could not be loaded: Error instantiating bean of type [info.novatec.micronaut.zeebe.client.feature.ZeebeWorkerSubscriptionCreator]: io/micronaut/jdbc/DataSourceResolver
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1938)
at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:237)
at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:3453)
at io.micronaut.context.DefaultBeanContext.finalizeConfiguration(DefaultBeanContext.java:3883)
at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:329)
at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:183)
at io.micronaut.runtime.Micronaut.start(Micronaut.java:72)
at io.micronaut.runtime.Micronaut.run(Micronaut.java:313)
at io.micronaut.runtime.Micronaut.run(Micronaut.java:299)
at com.example.Application.main(Application.java:8)
Caused by: io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [info.novatec.micronaut.zeebe.client.feature.ZeebeWorkerSubscriptionCreator]: io/micronaut/jdbc/DataSourceResolver
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2365)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:3281)
at io.micronaut.context.DefaultBeanContext.loadContextScopeBean(DefaultBeanContext.java:2664)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1932)
... 9 common frames omitted
Caused by: java.lang.NoClassDefFoundError: io/micronaut/jdbc/DataSourceResolver
at io.micronaut.management.health.indicator.jdbc.$JdbcIndicator$Definition.(Unknown Source)
at io.micronaut.management.health.indicator.jdbc.$JdbcIndicator$Definition$Reference.load(Unknown Source)
at io.micronaut.context.AbstractInitializableBeanDefinitionReference.load(AbstractInitializableBeanDefinitionReference.java:145)
at io.micronaut.context.DefaultBeanContext.lambda$getAllBeanDefinitions$14(DefaultBeanContext.java:1540)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.concurrent.ConcurrentLinkedQueue.forEachFrom(ConcurrentLinkedQueue.java:1037)
at java.base/java.util.concurrent.ConcurrentLinkedQueue$CLQSpliterator.forEachRemaining(ConcurrentLinkedQueue.java:894)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at io.micronaut.context.DefaultBeanContext.getAllBeanDefinitions(DefaultBeanContext.java:1542)
at info.novatec.micronaut.zeebe.client.feature.ZeebeWorkerSubscriptionCreator.(ZeebeWorkerSubscriptionCreator.java:62)
at info.novatec.micronaut.zeebe.client.feature.$ZeebeWorkerSubscriptionCreator$Definition.build(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2336)
... 12 common frames omitted
Caused by: java.lang.ClassNotFoundException: io.micronaut.jdbc.DataSourceResolver
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 28 common frames omitted
3 actionable tasks: 1 executed, 2 up-to-date

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':run'.

Process 'command '/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 2s
15:11:26: Task execution finished 'run'.
`

Replicate: download micronaut app with zeebe and management dependencies from launcher and run application: https://micronaut.io/launch/?type=DEFAULT&name=demo&package=com.example&javaVersion=JDK_11&lang=JAVA&build=GRADLE&test=JUNIT&features=management&features=zeebe&version=3.2.7

NoSuchMethodError GeneratedMessageV3.isStringEmpty() when used in maven project

When micronaut-zeebe-client is used as dependency in a maven project, the following error occurs after connecting to the Zeebe-engine:

Exception in thread "grpc-default-executor-0" java.lang.NoSuchMethodError: 'boolean com.google.protobuf.GeneratedMessageV3.isStringEmpty(java.lang.Object)'
	at io.camunda.zeebe.gateway.protocol.GatewayOuterClass$ActivateJobsRequest.getSerializedSize(GatewayOuterClass.java:499)
	at io.grpc.protobuf.lite.ProtoInputStream.available(ProtoInputStream.java:108)
	at io.grpc.internal.MessageFramer.getKnownLength(MessageFramer.java:205)
	at io.grpc.internal.MessageFramer.writePayload(MessageFramer.java:137)
	at io.grpc.internal.AbstractStream.writeMessage(AbstractStream.java:65)
	at io.grpc.internal.ForwardingClientStream.writeMessage(ForwardingClientStream.java:37)
	at io.grpc.internal.DelayedStream$6.run(DelayedStream.java:282)
	at io.grpc.internal.DelayedStream.drainPendingCalls(DelayedStream.java:181)
	at io.grpc.internal.DelayedStream.access$100(DelayedStream.java:43)
	at io.grpc.internal.DelayedStream$4.run(DelayedStream.java:147)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)

micronaut-zeebe-client version 1.4.0
micronaut version 3.3.4

Reason:
In micronaut-bom 3.3.4 version 3.17.2 from com.google.protobuf:protobuf-bom is required. But the method isStringEmpty() was added to GeneratedMessageV3 only in version 3.18, so zeebe-client-java requires at least this version.

The dependency conflict can be solved by adding explicitly a newer version of com.google.protobuf:protobuf-java to the project, e. g.

    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>3.19.4</version>
    </dependency>

The problem does not occur when build with Gradle, because Gradle prefers the higher version in a version conflict.

Connecting to a secure zeebe cluster

Hello Guys,

I have a secure zeebe cluster deployed in kubernetes using the helm chart, when I want to connect to the cluster using this client, I have received this error:

__  __ _                                  _   
|  \/  (_) ___ _ __ ___  _ __   __ _ _   _| |_ 
| |\/| | |/ __| '__/ _ \| '_ \ / _` | | | | __|
| |  | | | (__| | | (_) | | | | (_| | |_| | |_ 
|_|  |_|_|\___|_|  \___/|_| |_|\__,_|\__,_|\__|
  Micronaut (v3.2.7)

10:32:44.374 [main] INFO  i.n.m.z.c.feature.ZeebeClientFactory - ZeebeClient is configured to connect to gateway: localhost:26500
10:32:44.406 [ForkJoinPool.commonPool-worker-17] INFO  i.n.m.z.c.f.ZeebeWorkerProcessor - Zeebe client (com.worldremit.api.service.ProcessService#createTransaction) subscribed to type 'create_transaction'
10:32:44.669 [main] INFO  io.micronaut.runtime.Micronaut - Startup completed in 1333ms. Server Running: http://localhost:8085/
10:32:44.734 [grpc-default-executor-1] WARN  io.camunda.zeebe.client.job.poller - Failed to activated jobs for worker default and job type create_transaction
io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]
	at io.grpc.Status.asRuntimeException(Status.java:535)
	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:479)
	at io.grpc.internal.DelayedClientCall$DelayedListener$3.run(DelayedClientCall.java:463)
	at io.grpc.internal.DelayedClientCall$DelayedListener.delayOrExecute(DelayedClientCall.java:427)
	at io.grpc.internal.DelayedClientCall$DelayedListener.onClose(DelayedClientCall.java:460)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:562)
	at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:743)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:722)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 00001204000000000000037fffffff000400100000000600002000000004080000000000000f0001
	at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1213)
	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1283)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:449)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	... 1 common frames omitted

The important error is this one: Caused by: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 00001204000000000000037fffffff000400100000000600002000000004080000000000000f0001
Do you know why the client cannot connect to the secure cluster?

Thank you!

Write Blog post

  • Write blog post
  • publish on social media
  • link github project to blog
  • update section "publications"
  • PR to update awesome list
  • PR to update zeebe docs
  • Camunda Developer Newsletter

Update to Micronaut 4.2

Blocked by

Caused by: java.lang.UnsupportedOperationException: null
	at io.grpc.netty.AbstractHttp2Headers.isEmpty(AbstractHttp2Headers.java:40)
	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:419)
	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:352)
	at io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onHeadersRead(Http2InboundFrameLogger.java:56)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader$2.processFragment(DefaultHttp2FrameReader.java:476)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readHeadersFrame(DefaultHttp2FrameReader.java:484)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:253)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:159)
	at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41)
	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:188)
	at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:393)
	at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:453)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	... 1 common frames omitted

Note: if you set "this.validateHeaders = validateHeaders" to false false in the debugger in the class io.netty.handler.codec.http2:DefaultHttp2ConnectionDecoder then the application starts succesfully.

image

Let's see if a Micronaut Update fixes this.

Parallel Initialisation of Workers

Does it makes sense (i.e. will it have an impact?) to parallelize the initialisation of workers?

If yes, then lets parallelize the initialisation.

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.