# WxRedis **Repository Path**: mirrors_ibm/WxRedis ## Basic Information - **Project Name**: WxRedis - **Description**: this is for WxRedis package! - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: 10.15 - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-17 - **Last Updated**: 2026-01-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # WxRedis Package ## Problem Statement In webMethods Integration(ESB), there is no direct connectivity with Redis, while some customers want to use Redis instead of Terracotta Caching for distributed caching. ## Solution The **WxRedis Package** has been developed using **Jedis API v6.1.0** (latest as of 08/2025). - Jedis is a **lightweight, low-level API** that provides all operations to Redis with **synchronous connectivity**. - It maintain connection pools using **Apache Commons Pool (commons-pool2-2.12.1.jar, latest as of 08/2025)**. - Serialization and Deseraialization of Idata Document is achived using **Apachee Jackson jars(jackson-core-2.20.0.jar, jackson-databind-2.20.0.jar, jackson-annotations-2.20.jar)**. - Supports **Clustered** and **Standalone Redis** deployments. - Includes SSL/TLS connectivity leveraging Integration Server's **Keystore, Key Alias, and TrustStore**. - Built-in support for **mTLS** (mutual TLS), with flexibility for **self-signed or CA-signed certificates** . - Connection pool statistics and health-check services included. - **IWHI** also supports this package. ### References - [Jedis Documentation](https://redis.io/docs/latest/develop/clients/jedis/) - [Jedis Javadoc](https://www.javadoc.io/doc/redis.clients/jedis/latest/index.html) - [Jedis GitHub](https://github.com/redis/jedis/tree/master?tab=readme-ov-file) --- ## Supporting Java Project A helper Java project `redistools.Redis` is included as a jar in WxRedis package: - Establishes and maintains **connection pools**. - Provides **pool statistics** (borrowed connections, idle connections, etc.). - Supports **SSL/TLS and mTLS** using Integration Server keystores and truststores(JKS/PKCS). - Leverages `ISKeyStoreManager` to access Keystore/Truststore aliases configured in IS – IS manages unlocking of TrustStore. - SSL and mTLS features are tested with: - Self-signed - Mutual TLS (with IS keystore + truststore aliases configured) ⚠️ SSL and mTLS features require **proper environment testing** with: - CA-signed certificates --- ## IS Services ### Cache Services - `WxRedis.services.cache:getCacheEntity` – Get value for a given key - `WxRedis.services.cache:setCacheEntity` – Set key-value entity where value can be a String/ Idata Document / any Java Premitive variable(short, int, long, date, boolean, float,double, bigint, char, byte, bytearray). - `WxRedis.services.cache:deleteAllCacheEntities` – Delete all entities (with pattern) - `WxRedis.services.cache:deleteCacheEntity` – Delete a specific entity - `WxRedis.services.cache:getAllCacheEntites` – Get all key-value pairs (with optional pattern) - `WxRedis.services.cache:getAllKeys` – Get all keys (with optional pattern) ### Pool & Connection Services - `WxRedis.init:initializeJedisConnection` – Initialize Redis connection & pool for standalone/clustered Redis server (Startup Service) - `WxRedis.init:dropRedisPool` – Drop Redis pool and cleanup (Shutdown Service) - `WxRedis.services.pool:getStats` – Get connection pool statistics - `WxRedis.services.pool:healthCheck` – Live health check (PING) for standalone/clustered Redis ### Utility Services - `WxRedis.utils:updateGlobalVariable` – Update Global variables residing in WxRedis Packages. Reason for having this service is to update the package global variables in webMethods Integration IPaaS if the package is needed for CloudRuntime. - **Note**: updateGlobalVariable service works only with wMv11.1 and IWHI ( its not compatible with wMv10.15) --- ## Summary The **WxRedis Package** provides seamless, production-grade Redis connectivity for Integration Server with: - Connection pooling - SSL/mTLS support - Cluster + Standalone support - Health checks & statistics This makes Redis a viable alternative to **Terracotta Caching** for **distributed caching use cases**. --- ## 📌 Global Variables and Service Input/Output Documentation --- ### Global Variables | Variable Name | Description | | ----------------------------------------------| -------------------------------------------------------------------------- | | `redisIsClustered` | Boolean flag (`true`/`false`). Determines if Redis runs in clustered mode. | | `redisHost` | Redis hostname(comma-separated for clusters with port ex: host1:port,host2:port). For AWS MemCache for Redis/Standalone just specify Hostname and Port need to besprcified in port variable | | `redisPort` | Redis port (if port not specified for clusters) for AWS Memcache for Redis or Standalone provide port. | | `redisUsername` | Redis username if any else specify blank | | `redisPassword` | Redis password if any else specify blank(variable type: Password) | | `redisUseSSL` | `true`/`false`. Enables TLS/SSL connection to Redis. | | `redisKeystoreAlias` | IS Keystore alias used for client certificate ( 2-waySSL/mTLS). | | `redisKeystoreKeyAlias` | Specific private key alias inside the IS Keystore (for 2-waySSL/mTLS). | | `redisKeystorePassword` | IS Keystore alias password (for 2-waySSL/mTLS) for store type jks/pkcs.(variable type: Password) | | `redisKeystoreKeyAliasPassword` | Keystore private key alias password (for 2-waySSL/mTLS)for store type jks.(variable type: Password) | | `redisTruststoreAlias` | IS Truststore alias used to validate Redis server certificates. For 1-waySSL/TLS this is mandatory. | | `redisMinimumConnections` | Minimum total connections in pool(that is Minimum Idle Connections). | | `redisMaximumIdleConnections` | Maximum Idle connections in pool. | | `redisMaximumConnections` | Maximum total connections in pool. | | `redisConnectionTimeout` | Maximum wait time in ms for a connection (before timeout). | | `redisOperationTimeout` | Socket Timeout in ms. | ⚠️ Notes: - All the Global Variables should be configured under package WxRedis - Ex: - Package -> WxRedis - Key -> redisHost - Value -> localhost - For 1-waySSL/2WaySSL redisUseSSL should be true else it should be false. - For TLS/1-waySSL only redistruststoreAlias is needed; if mTLS/2-waySSL all store-related variables are mandatory, such as redistruststoreAlias, redisKeystoreAlias, redisKeystorePassword, redisKeystoreKeyAliasPassword. --- ### `WxRedis.services.cache:getCacheEntity` - **Description:** Fetch a single cache entry by key. - **Inputs:** - `key` *(String, required)* → Redis key. - `isClustered` *(String, optional)* → `true` or `false`. If null, falls back to global variable `redis.isClustered`. - **Outputs:** - `value` *(Object)* → Retrieved cache value. - `status` *(String)* → `success` or `failed`. - `error` *(String)* → Error details if failed. --- ### `WxRedis.services.cache:setCacheEntity` - **Description:** Insert/Update a cache entry. - **Inputs:** - `key` *(String, required)* → Redis key. - `value` *(Object, required)* → Value to store. - `expiryMilliSec` *(String, optional)* → Time-to-live in millisec (if null, entry is persistent). - `isClustered` *(String, optional)* → `true` or `false`. If null, falls back to global variable `redis.isClustered`. - **Outputs:** - `status` *(String)* → `success` or `failed`. - `error` *(String)* → Error details if failed. - Ex: Value would be stored as follows in Redis. - String -> plain (no wrapper) - Others -> JSON wrapper { "_t": , "_v": } -t holds the type such as for Idata -> idata_json, byte[] -> bytes_b64, Date -> date_epoch_ms, Boolean -> boolean, Byte -> byte, Short -> short, Integer -> int, Long -> long, Float -> float, Double -> double, BigInteger -> bigint, BigDecimal -> bigdec, Character -> char any other classes -> classname -v holds value in JSON format --- ### `WxRedis.services.cache:deleteCacheEntity` - **Description:** Delete a single cache entry by key. - **Inputs:** - `key` *(String, required)* → Redis key. - `isClustered` *(String, optional)* → `true` or `false`. If null, falls back to global variable `redis.isClustered`. - **Outputs:** - `status` *(String)* → `success` or `failed`. - `error` *(String)* → Error details if failed. --- ### `WxRedis.services.cache:deleteAllCacheEntities` - **Description:** Delete multiple cache entries matching a **pattern**. - **Inputs:** - `pattern` *(String, required)* → Redis key pattern ( `prefix*` This is to avoid clearing of DB.) `*` for all is not allowed. - `isClustered` *(String, optional)* → `true` or `false`. If null, falls back to global variable `redis.isClustered`. - **Outputs:** - `deletedCount` *(String)* → Number of keys deleted. - `status` *(String)* → `success` or `failed`. - `error` *(String)* → Error details if failed. --- ### `WxRedis.services.cache:getAllCacheEntities` - **Description:** Fetch all cache entries matching a **pattern**. - **Inputs:** - `pattern` *(String, required)* → Redis key pattern( `*` or `prefix*`). - `isClustered` *(String, optional)* → `true` or `false`. If null, falls back to global variable `redis.isClustered`. - **Outputs:** - `elements` *(Document List)* → List of `{key(String), value(Object)}` pairs. - `status` *(String)* → `success` or `failed`. - `error` *(String)* → Error details if failed. --- ### `WxRedis.services.cache:getAllKeys` - **Description:** Retrieve all Redis keys matching a **pattern**. - **Inputs:** - `pattern` *(String, required)* → Redis key pattern( `*` or `prefix*`). - `isClustered` *(String, optional)* → `true` or `false`. If null, falls back to global variable `redis.isClustered`. - **Outputs:** - `keys` *(String List)* → List of matching keys. - `status` *(String)* → `success` or `failed`. - `error` *(String)* → Error details if failed. --- ### `WxRedis.services.pool:getStats` - **Description:** Provides **pool usage statistics** (not a health check). - **Inputs:** *(None)* - **Outputs:** - `log` *(String)* → Active, Idle, eaiters etc connections → ex:JedisPool: Active=0, Idle=1, Waiters=0, Total=1, maxTotal=30, minIdle=5, maxIdle=8 . --- ### `WxRedis.services.pool:healthCheck` - **Description:** Performs a Redis **PING check** to validate connectivity. - **Inputs:** - `isClustered` *(String, optional)* → `true` or `false`. If null, falls back to global variable `redis.isClustered`. - **Outputs:** - `status` *(String)* → `SUCCESS` or `FAILED`. - `error` *(String)* → Error details if failed. --- ### `WxRedis.init:initializeJedisConnection` - **Description:** Initializes the Jedis pool/cluster connection. This is Startup service of the package. - **Inputs:** *(None)* - All params are taken from Global variables - **Outputs:** *(None)* - Writes a log to IS Server log ex: ---------Redis Client Startup: localhost JedisPool: Active=0, Idle=0, Waiters=0, Total=0, maxTotal=30, minIdle=5, maxIdle=8-----------. --- ### `WxRedis.init:dropRedisPool` - **Description:** Drops/clears the Jedis connection pool. This is shutdown service of the package. - **Inputs:** *(None)* - **Outputs:** *(None)* --- ### `WxRedis.utils:updateGlobalVariable` - **Description:** Update global variables that are in WxRedis package. - **Inputs:** - `variableName` *(String)* → variable Name - `variableValue` *(String)* → variable value - `isSecure` *(String)* → `true` or `false` (if it's a password, then `true` else `false`) - **Outputs:** - `status` *(String)* → `success` or `failed`. - **Note**: updateGlobalVariable service works only with wMv11.1 and later versions and IWHI (its not compatible with wMv10.15) --- ## Improvements Roadmap - Current implementation connects to **one Redis server per JVM instance**. - Future enhancement: allow **multiple Redis connections** in parallel. - Extend support for **advanced Redis data types** (Hashes, Lists, Sets, Sorted Sets). - Add **distributed locking** mechanisms (similar to Redisson `RLock`). ## Contribution This is an open-source project and requires community contributions to remain useful. Anyone can contribute to the project in the following ways: 1. Fork this repository. 2. Make your enhancements/ changes. 3. Create a Pull Request. 4. Finally, development team will evaluate the Pull Request and merge it to the source code. ## Issues / Bugs In case of Bugs, please create an issue with following details 1. Version 2. Detailed description (with images if needed) 3. Error stacktace (log snippets) ## Disclaimer ### IBM Public Repository Disclosure All content in these repositories including code has been provided by IBM under the associated open source software license and IBM is under no obligation to provide enhancements, updates, or support. IBM developers produced this code as an open source project (not as an IBM product), and IBM makes no assertions as to the level of quality nor security, and will not be maintaining this code going forward.