Hey there. I’m following docs on adding a simple logging interceptor with the eventual goal of using a tenant-providing interceptor, but wanted to start with the simpler implementation you guys provided first. Docs here Interceptors | Camunda 8 Docs
The error I get which prevents zeebe from starting is:
Caused by: io.camunda.zeebe.gateway.interceptors.impl.InterceptorLoadException: Cannot load interceptor [logging-interceptor]: specified class does not implement ServerInterceptor
Here is the LoggingInterceptor.java file I used taken from the camunda docs and we can clearly see it implements ServerInterceptor
package com.foo;
import io.grpc.ForwardingServerCallListener.SimpleForwardingServerCallListener;
import io.grpc.Metadata;
import io.grpc.ServerCall;
import io.grpc.ServerCall.Listener;
import io.grpc.ServerCallHandler;
import io.grpc.ServerInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A simple interceptor that logs each incoming call. The class must be public
* since we will load it via JAR into the gateway.
*/
public final class LoggingInterceptor implements ServerInterceptor {
private static final Logger LOGGER =
LoggerFactory.getLogger("LoggingInterceptor");
@Override
public <ReqT, RespT> Listener<ReqT> interceptCall(
final ServerCall<ReqT, RespT> call,
final Metadata headers,
final ServerCallHandler<ReqT, RespT> next)
{
final Listener<ReqT> listener = next.startCall(call, headers);
return new SimpleForwardingServerCallListener<ReqT>(listener) {
@Override
public void onMessage(final ReqT message) {
LOGGER.trace("intercepted a call");
super.onMessage(message);
}
};
}
}
My application.yaml contains the below configurations:
zeebe:
broker:
gateway:
# allows specifying multiple interceptors
interceptors:
- # identifier, can be used for debugging
id: logging-interceptor
# name of our ServerInterceptor implementation
# this must be the fully qualified name of the class
className: com.foo.LoggingInterceptor
# path to the fat JAR, can be absolute or relative
jarPath: /tmp/engine-logging-interceptor-1.0-SNAPSHOT-jar-with-dependencies.jar
...
Just to be safe I tried specifying a class that does not exist in application.yaml to see if the same error occurred in which case it could mean that the path just isn’t resolving correctly, however if I use an invalid path I get the expected error: