How to Run Custom Connector in a Connector Runtime

I am using a custom connector of OpenWeatherAPI provided by Camunda Community Hub. But I am not able to establish my connector runtime with it, the response from my connector is not being fetched, the github code for the custom connector is: GitHub - camunda-community-hub/camunda-8-connector-openweather-api: A custom connector for Camunda Platform 8 to retrieve the weather forecast

I have cloned the above repo and did ‘mvn clean package’ to build the jar file, built the docker image by extending the base image:

FROM camunda/connectors:0.22.1

COPY target/openweather-api-0.1.0-SNAPSHOT.jar /opt/app/
 

specified the env.txt file by including the zeebe client id, cluster id, as well as api key

The part where I am stuck at is when I try to run my docker image using:

docker run --rm --name=OpenWeatherConnector -v $PWD/target/openweather-api-0.1.0-SNAPSHOT.jar:/opt/app/connector.jar --env-file env.txt camunda/connectors:0.22.0

I get an error in my container saying:

Caused by: org.apache.hc.client5.http.HttpHostConnectException: Connect to http://localhost:8081 [localhost/127.0.0.1] failed: Connection refused

Basically not able to establish connection with Operate, I tried for self managed environment as well, but still the same issue. I am not sure where I am going wrong,
I am interested in knowing the complete steps for my connector application to run in my connector runtime. Thanks

Hi @Altmash_Siddique ,
It might be because docker container cannot communicate to localhost,
Please provide your env file

Here is the env file:

ZEEBE_CLIENT_CLOUD_CLUSTER-ID=<cluster_id_that_i_used>
ZEEBE_CLIENT_CLOUD_CLIENT-ID=<client_id_that_i_used>
ZEEBE_CLIENT_CLOUD_CLIENT-SECRET=<client_secret_that_i_used>
ZEEBE_CLIENT_CLOUD_REGION=syd-1
OPENWEATHER_API_KEY=<openweather_api_key>

Imported all the above Id’s from my cluster created in Camunda
Other than this i also tried for self managed environment (It would be great if it works for this) where the env was as follows:

ZEEBE_CLIENT_BROKER_GATEWAY_ADDRESS=127.0.0.1:26500
ZEEBE_CLIENT_SECURITY_PLAINTEXT=true
OPENWEATHER_API_KEY=<openweather_api_key>

Hello @Altmash_Siddique ,

@Praveen_Kumar_Reddy is right: A docker container cannot point to your localhost.

Instead, it should point to the running container directly (and be registered in the same network).

Here is a blog post about it:

I hope this helps

Jonathan

1 Like

Thanks for the response @jonathan.lukas, I just tried running both the connectors in the same network by using bridge method, still it is causing the same issue of

2023-08-24T12:24:28.335Z  WARN 1 --- [           main] s.c.c.OperateClientProdAutoConfiguration : An attempt to connect to Operate failed: io.camunda.operate.exception.OperateException: org.apache.hc.client5.http.HttpHostConnectException: Connect to http://localhost:8081 [localhost/127.0

If in case I can get an overall idea of how to run a connector for a self managed environment, it would be great. Thanks

Hello @Altmash_Siddique ,

localhost will not take you anywhere here. You will still require to use the dedicated IP address of the other container as described in the forum post.

Jonathan

Hello @Altmash_Siddique,

Try using the same network for both self-managed and the container and communicate using container name rather than localhost or 127.0.0.1

You can find an example here

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.