GS2-Realtime Deploy/CDK 레퍼런스
엔티티
Deploy 처리에서 조작 대상이 되는 리소스
Namespace
네임스페이스
네임스페이스는 하나의 프로젝트 내에서 동일한 서비스를 서로 다른 용도로 여러 개 이용하기 위한 엔티티입니다.
GS2의 각 서비스는 네임스페이스 단위로 관리됩니다. 네임스페이스가 다르면 동일한 서비스라도 완전히 독립된 데이터 공간으로 취급됩니다.
따라서 각 서비스의 이용을 시작하려면 먼저 네임스페이스를 생성해야 합니다.
Request
리소스 생성·갱신 요청
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||||||
| description | string | ~ 1024자 | 설명문 | |||||||
| transactionSetting | TransactionSetting | 트랜잭션 설정 리얼타임 조작 시 트랜잭션 처리 방법을 제어하는 설정입니다. | ||||||||
| serverType | 문자열 열거형 enum { “relay” } | ✓ | 서버 타입 실시간 통신을 위해 프로비저닝하는 게임 서버의 타입. 현재 “relay” 모드를 지원하며, 접속된 게임 클라이언트 간에 메시지를 전달하는 패킷 릴레이 서버를 제공합니다.
| |||||||
| serverSpec | 문자열 열거형 enum { “realtime1.nano” } | ✓ | 서버 스펙 프로비저닝되는 게임 서버의 하드웨어 스펙 티어. 각 룸의 서버 인스턴스에 할당되는 컴퓨팅 리소스(CPU, 메모리)를 결정합니다. 현재 “realtime1.nano"를 지원합니다.
| |||||||
| createNotification | NotificationSetting | 룸 생성 완료 알림 룸의 프로비저닝이 완료되어 접속이 가능해졌을 때 트리거되는 푸시 알림 설정. 룸 생성은 비동기로 이루어지며(IP 주소, 포트, 암호화 키는 약간의 지연 후 할당됨), 이 알림을 통해 클라이언트에게 룸이 접속을 받을 준비가 되었음을 알립니다. | ||||||||
| logSetting | LogSetting | 로그 출력 설정 리얼타임 관련 조작 로그를 GS2-Log에 출력하기 위한 설정. 설정하면 룸 생성, 접속 이벤트, 메시지 릴레이 활동 등이 분석과 디버깅을 위해 기록됩니다. |
GetAttr
!GetAttr 태그로 취득 가능한 리소스 생성 결과
| 타입 | 설명 | |
|---|---|---|
| Item | Namespace | 생성한 네임스페이스 |
구현 예제
Type: GS2::Realtime::Namespace
Properties:
Name: namespace-0001
Description: null
TransactionSetting: null
ServerType: relay
ServerSpec: realtime1.nano
CreateNotification: null
LogSetting:
LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001import (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/realtime"
)
SampleStack := core.NewStack()
realtime.NewNamespace(
&SampleStack,
"namespace-0001",
realtime.NamespaceServerTypeRelay,
realtime.NamespaceServerSpecRealtime1Nano,
realtime.NamespaceOptions{
LogSetting: &core.LogSetting{
LoggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
},
)
println(SampleStack.Yaml()) // Generate Templateclass SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
new \Gs2Cdk\Realtime\Model\Namespace_(
stack: $this,
name: "namespace-0001",
serverType: \Gs2Cdk\Realtime\Model\Enums\NamespaceServerType::RELAY,
serverSpec: \Gs2Cdk\Realtime\Model\Enums\NamespaceServerSpec::REALTIME1_NANO,
options: new \Gs2Cdk\Realtime\Model\Options\NamespaceOptions(
logSetting: new \Gs2Cdk\Core\Model\LogSetting(
loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
)
)
);
}
}
print((new SampleStack())->yaml()); // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.realtime.model.Namespace(
this,
"namespace-0001",
io.gs2.cdk.realtime.model.enums.NamespaceServerType.RELAY,
io.gs2.cdk.realtime.model.enums.NamespaceServerSpec.REALTIME1_NANO,
new io.gs2.cdk.realtime.model.options.NamespaceOptions()
.withLogSetting(new io.gs2.cdk.core.model.LogSetting(
"grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
))
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Realtime.Model.Namespace(
stack: this,
name: "namespace-0001",
serverType: Gs2Cdk.Gs2Realtime.Model.Enums.NamespaceServerType.Relay,
serverSpec: Gs2Cdk.Gs2Realtime.Model.Enums.NamespaceServerSpec.Realtime1Nano,
options: new Gs2Cdk.Gs2Realtime.Model.Options.NamespaceOptions
{
logSetting = new Gs2Cdk.Core.Model.LogSetting(
loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
)
}
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Templateimport core from "@/gs2cdk/core";
import realtime from "@/gs2cdk/realtime";
class SampleStack extends core.Stack
{
public constructor() {
super();
new realtime.model.Namespace(
this,
"namespace-0001",
realtime.model.NamespaceServerType.RELAY,
realtime.model.NamespaceServerSpec.REALTIME1_NANO,
{
logSetting: new core.LogSetting(
"grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
)
}
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
from gs2_cdk import Stack, core, realtime
class SampleStack(Stack):
def __init__(self):
super().__init__()
realtime.Namespace(
stack=self,
name='namespace-0001',
server_type=realtime.NamespaceServerType.RELAY,
server_spec=realtime.NamespaceServerSpec.REALTIME1_NANO,
options=realtime.NamespaceOptions(
log_setting=core.LogSetting(
logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
),
),
)
print(SampleStack().yaml()) # Generate TemplateTransactionSetting
트랜잭션 설정
트랜잭션 설정은 트랜잭션의 실행 방법·정합성·비동기 처리·충돌 회피 메커니즘을 제어하는 설정입니다.
자동 실행(AutoRun), 원자적 실행(AtomicCommit), GS2-Distributor를 이용한 비동기 실행, 스크립트 결과의 일괄 적용, GS2-JobQueue를 통한 입수 액션의 비동기화 등을 조합하여 게임 로직에 맞는 견고한 트랜잭션 관리를 가능하게 합니다.
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| enableAutoRun | bool | false | 발행한 트랜잭션을 서버 사이드에서 자동으로 실행할지 여부 | |||
| enableAtomicCommit | bool | {enableAutoRun} == true | false | 트랜잭션의 실행을 원자적으로 커밋할지 여부 ※ enableAutoRun이(가) true 이면 활성화 | ||
| transactionUseDistributor | bool | {enableAtomicCommit} == true | false | 트랜잭션을 비동기 처리로 실행할지 여부 ※ enableAtomicCommit이(가) true 이면 활성화 | ||
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true | false | 스크립트의 결과 커밋 처리를 비동기 처리로 실행할지 여부 ※ transactionUseDistributor이(가) true 이면 활성화 | ||
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true | false | 입수 액션을 실행할 때 GS2-JobQueue를 사용할지 여부 ※ enableAtomicCommit이(가) true 이면 활성화 | ||
| distributorNamespaceId | string | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024자 | 트랜잭션 실행에 사용하는 GS2-Distributor 네임스페이스 GRN | ||
| queueNamespaceId | string | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024자 | 트랜잭션 실행에 사용하는 GS2-JobQueue의 네임스페이스 GRN |
NotificationSetting
푸시 통지에 관한 설정
GS2의 마이크로서비스 내에서 어떠한 이벤트가 발생했을 때, 푸시 통지를 전송하기 위한 설정입니다.
여기서 말하는 푸시 통지란 GS2-Gateway가 제공하는 WebSocket 인터페이스를 경유하는 처리이며, 스마트폰의 푸시 통지와는 성질이 다릅니다.
예를 들어 매치메이킹이 완료되었을 때나 친구 요청이 도착했을 때 등, 게임 클라이언트의 조작과는 관계없이 상태가 변화했을 때 GS2-Gateway를 경유하여 푸시 통지를 함으로써, 게임 클라이언트는 상태 변화를 감지할 수 있습니다.
GS2-Gateway의 푸시 통지는 통지 대상 디바이스가 오프라인이었을 때 추가 처리로 모바일 푸시 통지를 전송할 수 있습니다.
모바일 푸시 통지를 잘 활용하면, 매치메이킹 중에 게임을 종료하더라도 모바일 푸시 통지를 사용하여 플레이어에게 알리고, 게임으로 복귀하도록 하는 흐름을 구현할 수 있을 가능성이 있습니다.
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| gatewayNamespaceId | string | “grn:gs2:{region}:{ownerId}:gateway:default” | ~ 1024자 | 푸시 통지에 사용할 GS2-Gateway의 네임스페이스 “grn:gs2:“로 시작하는 GRN 형식으로 GS2-Gateway의 네임스페이스 ID를 지정합니다. | ||||||||
| enableTransferMobileNotification | bool? | false | 모바일 푸시 통지로 전달할지 여부 이 통지를 전송하려 할 때, 통지 대상 디바이스가 오프라인일 경우 모바일 푸시 통지로 전달할지 여부를 지정합니다. | |||||||||
| sound | string | {enableTransferMobileNotification} == true | ~ 1024자 | 모바일 푸시 통지에서 사용할 사운드 파일명 여기서 지정한 사운드 파일명은 모바일 푸시 통지를 전송할 때 사용되며, 특별한 사운드로 통지를 출력할 수 있습니다. ※ enableTransferMobileNotification이(가) true 이면 활성화 | ||||||||
| enable | 문자열 열거형 enum { “Enabled”, “Disabled” } | “Enabled” | 푸시 통지를 활성화할지 여부
|
LogSetting
로그 출력 설정
로그 데이터의 출력 설정을 관리합니다. 이 타입은 로그 데이터를 출력하기 위해 사용되는 GS2-Log 네임스페이스의 식별자(Namespace ID)를 보관합니다.
로그 네임스페이스ID(loggingNamespaceId)에는 로그 데이터를 수집하여 저장하는 GS2-Log의 네임스페이스를 GRN 형식으로 지정합니다.
이 설정을 하면 설정된 네임스페이스 내에서 발생한 API 요청·응답 로그 데이터가 대상 GS2-Log 네임스페이스 쪽으로 출력됩니다.
GS2-Log에서는 실시간으로 로그가 제공되어 시스템 모니터링, 분석, 디버깅 등에 활용할 수 있습니다.
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| loggingNamespaceId | string | ✓ | ~ 1024자 | 로그를 출력할 GS2-Log의 네임스페이스
GRN
“grn:gs2:“로 시작하는 GRN 형식의 ID로 지정해야 합니다. |