> For the complete documentation index, see [llms.txt](https://jakekwak.gitbook.io/nestjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jakekwak.gitbook.io/nestjs/microservices/untitled.md).

# 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) |
