Trying to use ConnectorRequestInterceptor to log request and response whenever a http-connector service task is executing


Application: Spring boot , ConnectorRequestInterceptor , camunda

I am trying to log request and response of api that are being hit by connector(service task) .
For intercept the requests to log the payload and other details have tried using org.camunda.connect.spi.ConnectorRequestInterceptor but I am not able to register the ConnectorRequestInterceptor in the project as a result not able to log the request payload also I am not able to understand how to catch the response and log it.
Any sort of help would be deeply appreciated. Thanks in advance.
Please find my code below:

import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.camunda.connect.impl.ConnectCoreLogger;
import org.camunda.connect.impl.ConnectLogger;
import org.camunda.connect.spi.ConnectorInvocation;
import org.camunda.connect.spi.ConnectorRequestInterceptor;
import org.springframework.stereotype.Component;

public class RequestLogging implements ConnectorRequestInterceptor {
private static final Log log = LogFactory.getLog(RequestLogging.class);

protected static ConnectCoreLogger LOG = ConnectLogger.CORE_LOGGER;

public static String HTTP_CONNECTOR_ID = "http-connector";
public static String SOAP_HTTP_CONNECTOR_ID = "soap-http-connector";

// @Override
// public void process(Request request, Response response) throws IOException {
// try {
//“Received request: " + request.getMethod() + " " + request.getRequestURI()+” "+request.getInputStream());
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// }

public Object handleInvocation(ConnectorInvocation invocation) throws Exception {

   Object r1= invocation.getTarget();"request target*******"+r1.toString());"request details******"+invocation.getRequest());

    return invocation.proceed();

    //return true;


Main class:
import org.camunda.connect.Connectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;

public class Application {

private RequestLogging requestLogging;
// private RequestLogging loggingConnectorRequest;

public void setRequestLogging(RequestLogging requestLogging) {
this.requestLogging = requestLogging;
static Logger log = LoggerFactory.getLogger(Application.class);
public static void main(String… args) {, args);"main method");

public Connectors registerConnectorInterceptor() {
Connectors INSTANCE = Connectors.getInstance();
System.out.println(“connector called”);
return INSTANCE;