npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

redis-connector-nodejs

v1.0.15

Published

Redis connector to perform outbound integration from your Camunda 8 platform. Supports JSON data format.

Downloads

18

Readme

redis-connector-nodejs

Redis connector to perform outbound integration from your Camunda 8 platform. Supports JSON data format and standard operations. See below.

Operations supported

Standard CRUD operations - GET, PUT and DELETE.

Note: Put operation supports both creating a new record as well as updating existing record.

Redis version

Connector operations are tested against below Redis instance running on Google Cloud.

redis_version:7.2.0

redis_mode:standalone

os:Linux 5.4.0-1064-gcp x86_64

gcc_version:7.5.0

Code Quality

Quality gate checks successfully executed leveraging Sonar Cloud.

Click on link below to see detailed report.

Quality gate

How to run unit / integration test cases?

Open VS Code. Clone the repository. Make sure you have access to Redis database.

Open terminal and run below two commands.

npm run build yarn jest --coverage (or npm test)

Note a: Make sure to export env variables to connect with your Redis instance.

export REDIS_HOSTNAME=your-db-name-here.redislabs.com

export REDIS_PORT=11485

export REDIS_USER=user-name

export REDIS_SECRET=a-valid-pwd-for-your-env

export REDIS_SECRET_DUMMY=ask-me-for-this

Note b: The dummy secret REDIS_SECRET_DUMMY is used for running negative test case (connection error simulation).

I want to practice somethig simple first. How can I do that?

If you are new to Connector SDK, then I recommend you to try the weather-api sample so you are familiar with NodeJS connector wrapper, configuration points and how the nuts & bolts essentially work.

The steps are outlined here:

https://github.com/camunda-community-hub/camunda-8-connector-openweather-api

How to run redis connector using Docker?

If you haven't done yet, I recommend running Unit Test cases as outlined in the above section. The unit testing allows you to catch any configuration errors quickly and fix them before you try your hand with end to end flow.

Now that you are ready to run the end to end flow, lets get to it.

Pre-requisites:

a. Make sure you have Docker running.
b. Have a running Redis database instance with details such as hostname, port, username and password.
c. Camunda 8 environment.
d. Create a set of Client ID and Client Secret for Zeebe. These entries will then be added to the connector .env file. Step #5.1
e. Upload the redis-connector template json file to your Camunda 8 environment. The template file is here: element-templates/redis-connector.json
f. Build a simple BPMN process. Or, you can reference the file under element-templates.
g. You are all set. Lets keep going!

Steps:

  1. Clone the repository mentioned in the References section below.

    https://github.com/camunda-community-hub/connector-sdk-nodejs

  1. I am assuming $base is the folder where you have cloned the repository.

3. Lets prepare the connector.

3.1. I have published redis-connector-nodejs as npm package. So we are going to make a reference to that.

3.2. Go to the folder (__connectors__) under runtime worker. This is where we are going to include or link the redis connector.

$base/connector-sdk-nodejs/connector-runtime-worker/__connectors__

3.3. Open the file: package.json and make sure you have below item under dependencies. Save the changes.

"dependencies": { "redis-connector-nodejs": "^1.0.14" }

3.4. Run the command:

npm install redis-connector-nodejs

Note: If you encounter any error at this step, make sure you are able to reach the url: https://www.npmjs.com/package/redis-connector-nodejs

Note: Just to make sure, you should see the redis connector folder under node_modules.

4. Lets prepare the runtime wrapper.

4.1. Go to the folder.

$base/connector-sdk-nodejs/connector-runtime-worker

4.2. Make sure to add below environment var names to docker-compose.yml. (Only the var names here. The values go into the .env file. See #5.1)

Note: I am taking db password as a secret parameter.

> ```
>    environment:
>      - LOG_LEVEL=INFO
>      - ZEEBE_ADDRESS
>      - ZEEBE_CLIENT_ID
>      - ZEEBE_CLIENT_SECRET
>      - ZEEBE_AUTHORIZATION_SERVER_URL
>      - REDIS_SECRET
> ```
> 

4.3. Let's build the Docker image.

Run below two commands one after other.
$ npm run build
$ docker build --tag sitapati/c8-connector-worker-runtime-nodejs:latest .

4.4. Yay! At this stage, you should see the Docker image for the connector wrapper. The wrapper points to the redis connector implementation.

5. Time to put all things together.

5.1. Create a file .env in the folder: $base/connector-sdk-nodejs/connector-runtime-worker.

REDIS_SECRET=put-db-password-here
ZEEBE_ADDRESS=value-here
ZEEBE_CLIENT_ID=value-here
ZEEBE_CLIENT_SECRET=value-here
ZEEBE_AUTHORIZATION_SERVER_URL=value-here
ZEEBE_TOKEN_AUDIENCE='zeebe.camunda.io'
CAMUNDA_CLUSTER_ID=value-here
CAMUNDA_CLUSTER_REGION=value-here
CAMUNDA_CREDENTIALS_SCOPES='Zeebe'
CAMUNDA_OAUTH_URL='https://login.cloud.camunda.io/oauth/token'

5.2. Make sure to not add this file to any code repository.

5.3. Run the command to start docker container and seed the .env file.

[connector-runtime-worker]$ docker compose --env-file .env up

5.4. Keep an eye on the logs. The runtime container logs show you messages to indicate connector has been found or loaded.

zeebe |  INFO: Authenticating client with Camunda Cloud...
Scanning for: /opt/connectors/package.json
Found package.json
Loading redis-connector-nodejs from /opt/connectors/node_modules/redis-connector-nodejs
Adding Connector:
{
  name: 'RedisConnectorNodeJS',
  type: 'io.camunda:redis-connector-nodejs:1',
  inputVariables: [ 'hostname', 'port', 'user', 'token', 'operationType', 'key', 'data' ]
}

Common Issues

Zeebe configuration and Redis configuration are the most common mistakes. Make sure spelling mistakes are avoided.

References

The redis-connector-nodejs code base has been built on the SDK defined here.

https://github.com/camunda-community-hub/connector-sdk-nodejs

Contact for Support

If you need any help, we are just an email away - [email protected]