# Redis

## Redis

두 번째 내장 전송기는 [Redis](https://redis.io/) 데이터베이스를 기반으로 합니다. 이 트랜스포터는 **게시(publish)/구독(subscribe)** 기능을 이용합니다.

## Installation

시작하기 전에 필요한 패키지를 설치해야합니다.

```bash
$ npm i --save redis
```

## Overview

TCP 전송 전략에서 Redis **pub/sub**로 전환하려면 `createMicroservice()`메소드에 전달된 옵션 객체를 변경해야합니다.

```typescript
@@filename(main)
const app = await NestFactory.createMicroservice(ApplicationModule, {
  transport: Transport.REDIS,
  options: {
    url: 'redis://localhost:6379',
  },
});
```

> info **힌트** `Transport` 열거자는 `@nestjs/microservices` 패키지에서 가져옵니다.

## Options

트랜스포터의 행동을 결정하는 여러 가지 옵션이 있습니다.

| `url`           | Connection url   |
| --------------- | ---------------- |
| `retryAttempts` | 총 연결 시도 횟수       |
| `retryDelay`    | 연결 재시도 지연 시간(ms) |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jakekwak.gitbook.io/nestjs/microservices/untitled.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
