> ## Documentation Index
> Fetch the complete documentation index at: https://prefect-bd373955-codex-docket-background-task-ha.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# messaging

# `prefect_redis.messaging`

## Functions

### `ephemeral_subscription` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L694" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
ephemeral_subscription(topic: str, source: Optional[str] = None, group: Optional[str] = None) -> AsyncGenerator[dict[str, Any], None]
```

### `break_topic` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L726" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
break_topic()
```

## Classes

### `RedisMessagingPublisherSettings` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L67" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Settings for the Redis messaging publisher.

No settings are required to be set by the user but any of the settings can be
overridden by the user using environment variables.

### `RedisMessagingConsumerSettings` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L93" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Settings for the Redis messaging consumer.

No settings are required to be set by the user but any of the settings can be
overridden by the user using environment variables.

### `Cache` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L161" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

**Methods:**

#### `clear_recently_seen_messages` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L166" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
clear_recently_seen_messages(self) -> None
```

#### `forget_duplicates` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L195" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
forget_duplicates(self, attribute: str, messages: list[M]) -> None
```

#### `without_duplicates` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L169" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
without_duplicates(self, attribute: str, messages: list[M]) -> list[M]
```

### `RedisStreamsMessage` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L209" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

A message sent to a Redis stream.

**Methods:**

#### `acknowledge` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L227" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
acknowledge(self) -> None
```

### `Subscription` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L232" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

A subscription-like object for Redis. We mimic the memory subscription interface
so that we can set max\_retries and handle dead letter queue storage in Redis.

### `Publisher` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L243" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

**Methods:**

#### `publish_data` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L300" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
publish_data(self, data: bytes, attributes: dict[str, Any])
```

### `Consumer` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L336" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Consumer implementation for Redis Streams with DLQ support.

**Methods:**

#### `process_pending_messages` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L450" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
process_pending_messages(self, handler: MessageHandler, redis_client: Redis, message_batch_size: int, start_id: str = '0-0')
```

#### `run` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-redis/prefect_redis/messaging.py#L507" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python theme={null}
run(self, handler: MessageHandler) -> None
```
