Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default defineConfig({
collapsed: false,
items: [
{
text: 'mule-chunking-connector',
text: 'Chunking Connector',
collapsed: false,
items: [
{ text: 'Overview', link: '/connectors/mule-chunking-connector/' },
Expand All @@ -86,7 +86,7 @@ export default defineConfig({
]
},
{
text: 'mule-idp-connector',
text: 'IDP Connector',
collapsed: false,
items: [
{ text: 'Overview', link: '/connectors/mule-idp-connector/' },
Expand All @@ -111,6 +111,33 @@ export default defineConfig({
{ text: 'Universal REST Smart Connector', link: '/connectors/mule-idp-connector/mulesoft-idp-universal-rest-smart-connector' },
{ text: 'Dataweave', link: '/connectors/mule-idp-connector/dataweave' }
]
},
{
text: 'Lettuce Redis Connector',
collapsed: false,
items: [
{ text: 'Overview', link: '/connectors/mule-lettuce-redis-connector/' },
{ text: 'Set Up', link: '/connectors/mule-lettuce-redis-connector/set-up' },
{
text: 'Operations',
collapsed: true,
items: [
{ text: 'Operations Overview', link: '/connectors/mule-lettuce-redis-connector/operations/' },
{ text: 'Server', link: '/connectors/mule-lettuce-redis-connector/operations/server' },
{ text: 'Key / Value', link: '/connectors/mule-lettuce-redis-connector/operations/key-value' },
{ text: 'Hash', link: '/connectors/mule-lettuce-redis-connector/operations/hash' },
{ text: 'List', link: '/connectors/mule-lettuce-redis-connector/operations/list' },
{ text: 'Set', link: '/connectors/mule-lettuce-redis-connector/operations/set' },
{ text: 'Sorted Set', link: '/connectors/mule-lettuce-redis-connector/operations/sorted-set' },
{ text: 'Geospatial', link: '/connectors/mule-lettuce-redis-connector/operations/geospatial' },
{ text: 'Stream', link: '/connectors/mule-lettuce-redis-connector/operations/stream' },
{ text: 'Channel', link: '/connectors/mule-lettuce-redis-connector/operations/channel' },
{ text: 'Send Command', link: '/connectors/mule-lettuce-redis-connector/operations/send-command' },
{ text: 'Search Operations', link: '/connectors/mule-lettuce-redis-connector/operations/search-operations' }
]
},
{ text: 'Sources (Listeners)', link: '/connectors/mule-lettuce-redis-connector/sources' }
]
}
]
},
Expand All @@ -121,7 +148,7 @@ export default defineConfig({
collapsed: false,
items: [
{
text: 'mule-pdfbox-module',
text: 'PDFBox Module',
collapsed: false,
items: [
{ text: 'Overview', link: '/modules/mule-pdfbox-module/' },
Expand Down
70 changes: 70 additions & 0 deletions docs/connectors/mule-lettuce-redis-connector/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: Mule Lettuce Redis Connector
description: Direct access to Redis commands from Mule applications, built on the Lettuce reactive Redis client.
---

# Lettuce Redis Connector

A low-level connector providing Mule applications with direct access to Redis commands, built on the [Lettuce](https://lettuce.io/) reactive Redis client library. Published on Maven Central under `cloud.anypoint`.

The connector's goal is to provide full coverage of all documented Redis commands, organized by Redis data structure. For commands not yet implemented as dedicated operations, the [Send Command](./operations/send-command) operation lets you execute any arbitrary Redis command.

## Features

- **Broad command coverage**: Dedicated operations for strings, hashes, lists, sets, sorted sets, geospatial indexes, and streams
- **Pub/Sub event sources**: Trigger Mule flows in real time from Redis channels using SUBSCRIBE and PSUBSCRIBE
- **Dynamic command execution**: [Send Command](./operations/send-command) executes any Redis command not yet available as a dedicated operation
- **Automated SCAN iteration**: [Search Operations](./operations/search-operations) handle Redis cursor management internally, streaming full result sets without manual loop logic
- **Maven Central**: Install with a single Maven dependency — no local builds required

## Quick Example

```xml
<!-- Standard Redis configuration -->
<lettuce-redis:config name="Redis_Config">
<lettuce-redis:connection
host="localhost"
port="6379"
tls="false"
password="${secure::redis.password}"/>
</lettuce-redis:config>

<!-- Store a value -->
<lettuce-redis:set config-ref="Redis_Config" key="greeting" value="hello"/>

<!-- Retrieve it -->
<lettuce-redis:get config-ref="Redis_Config" key="greeting"/>

<!-- payload is now "hello" -->
<logger level="INFO" message="#[payload]"/>
```

## Supported Command Categories

| Category | Operations | Page |
|----------|-----------|------|
| Server | PING | [Server](./operations/server) |
| Key / Value | APPEND, COPY, DECR, DEL, EXPIRE, GET, GETDEL, GETEX, GETRANGE, GETSET, INCR, MGET, MSET, PERSIST, PEXPIRE, PTTL, SCAN, SET, TOUCH, TTL | [Key / Value](./operations/key-value) |
| Hash | HEXISTS, HGET, HGETALL, HINCRBY, HLEN, HMGET, HSCAN, HSET | [Hash](./operations/hash) |
| List | BLMOVE, BLPOP, BRPOP, LMOVE, LPOP, LPUSH, LSET, RPOP, RPUSH | [List](./operations/list) |
| Set | SADD, SCARD, SDIFF, SISMEMBER, SMEMBERS, SMISMEMBER, SPOP, SRANDMEMBER, SREM, SSCAN | [Set](./operations/set) |
| Sorted Set | ZADD, ZINCRBY, ZRANK, ZSCAN, ZSCORE | [Sorted Set](./operations/sorted-set) |
| Geospatial | GEOADD, GEODIST, GEOPOS, GEOSEARCH | [Geospatial](./operations/geospatial) |
| Stream | XACK, XADD, XDEL, XGROUP CREATE, XGROUP DESTROY, XINFO GROUPS, XRANGE, XREAD, XREADGROUP, XTRIM | [Stream](./operations/stream) |
| Channel | PUBLISH | [Channel](./operations/channel) |
| Send Command | Any Redis command (dynamic) | [Send Command](./operations/send-command) |
| Search Operations | Automated SCAN, HSCAN, SSCAN, ZSCAN iteration | [Search Operations](./operations/search-operations) |
| Sources (Listeners) | SUBSCRIBE, PSUBSCRIBE | [Sources](./sources) |

## Requirements

- **Mule Runtime**: 4.6.0 or later
- **Java**: 8, 11, or 17
- **Redis**: Any version supporting the commands you use

## Learn More

- [Set Up Guide](./set-up) — Installation and connection configuration
- [Operations Reference](./operations/) — All operations by category
- [Sources (Listeners)](./sources) — Pub/Sub event-driven flows
- [GitHub Repository](https://github.com/anypointcloud/mule-lettuce-redis-connector) — Source code and issues
110 changes: 110 additions & 0 deletions docs/connectors/mule-lettuce-redis-connector/operations/channel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
title: Channel Commands — Lettuce Redis Connector
description: Reference for channel (Pub/Sub) Redis commands in the Mule Lettuce Redis Connector
---

# Channel Commands

Channel commands are used to send messages to Redis Pub/Sub channels. To receive messages, see [Sources (Listeners)](../sources).

This page covers: **PUBLISH**

---

## PUBLISH

Publish a message to a Redis Pub/Sub channel.

> 📘 **Redis Reference**: [PUBLISH](https://redis.io/docs/latest/commands/publish/)

### XML Example

```xml
<lettuce-redis:publish doc:name="Publish notification"
config-ref="Redis_Config"
channel="order-events"
message='{"orderId": "12345", "status": "shipped"}'/>
```

### Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `channel` | String | Yes | — | The name of the channel to publish to |
| `message` | String | Yes | — | The message content to publish |

### Output

**Type**: `Long`

The number of subscribers that received the message. A return value of `0` means no clients were subscribed to the channel when the message was published.

::: warning Message Delivery
Redis Pub/Sub is fire-and-forget. If no subscriber is listening when PUBLISH is called, the message is lost. For durable messaging, consider using [Redis Streams](./stream) instead.
:::

### Errors

| Error Type | Condition |
|------------|-----------|
| `REDIS:COMMAND` | Connection failure or server error |

### Usage

::: info Configuration
PUBLISH uses the **standard configuration** (`lettuce-redis:config`), not the pub/sub configuration. Only the SUBSCRIBE and PSUBSCRIBE sources require the pub/sub configuration.
:::

**Common pattern: Publish and subscribe in the same application**

```xml
<!-- Standard config for PUBLISH -->
<lettuce-redis:config name="Redis_Config">
<lettuce-redis:connection
host="${redis.host}"
port="${redis.port}"
tls="false"
password="${secure::redis.password}"/>
</lettuce-redis:config>

<!-- Pub/Sub config for SUBSCRIBE sources -->
<lettuce-redis:pubsub-config name="Redis_PubSub_Config">
<lettuce-redis:pubsub-connection
host="${redis.host}"
port="${redis.port}"
tls="false"
password="${secure::redis.password}"/>
</lettuce-redis:pubsub-config>

<!-- Publish messages when orders are placed -->
<flow name="order-publisher">
<http:listener config-ref="HTTP_Config" path="/orders"/>

<lettuce-redis:publish
config-ref="Redis_Config"
channel="order-events"
message="#[payload]"/>

<set-variable variableName="subscriberCount" value="#[payload]"/>

<logger level="INFO"
message="Published to #[vars.subscriberCount] subscribers"/>
</flow>

<!-- Subscribe to order events and process them -->
<flow name="order-subscriber">
<lettuce-redis:subscribe-channel
config-ref="Redis_PubSub_Config"
channels="#[['order-events']]"/>

<logger level="INFO"
message="Received order event: #[payload]"/>

<flow-ref name="process-order-event"/>
</flow>
```

### See Also

- [Sources (Listeners)](../sources) — SUBSCRIBE and PSUBSCRIBE for receiving messages
- [Redis Streams](./stream) — Durable, persistent messaging with consumer groups
Loading