はじめに
GS2 は多数のマイクロサービスを提供しており、多くのケースはトランザクション処理として、《消費アクション》と《入手アクション》として抽象化されています。
一方で、トランザクションを実行するために必要な GS2-Distributor や GS2-JobQueue
各種暗号処理で利用する GS2-Key の暗号鍵、各種通知処理で使用する GS2-Gateway といったマイクロサービスとの関連付けは各マイクロサービスのネームスペース設定として設定が必要です。
この設定漏れや誤りによる不具合報告を多数頂戴する状況から、利用者にとってもGS2にとってもボトルネックになっていると感じていました。
変更の内容
2023年8月にはプロジェクトの作成時にこれらの設定のややこしいマイクロサービスに「default」という名前でネームスペースを作成するようになりました。
これによって、マネージメントコンソールを初めて操作する際でも、とりあえず選択可能な項目を選択することで設定を完了できるようになりました。
しかし、実際には GS2-SDK を利用する際にもこれらの値を正しく設定しなければ、意図する動作にならないケースがあり、まだこの対応では不十分でした。
今回の更新で、サーバー・SDKを共に大規模な更新を行い、これらの連携用の設定が未設定の場合は「default」ネームスペースを使用して動作するようになります。
変更の適用方法
サーバーサイドは自動的に未設定の場合でもデフォルトネームスペースが利用されます。
もし、プロジェクトの作成が 2023年8月 より前で、デフォルトネームスペースが作成されていない場合は以下の GS2-Deploy テンプレートを適用することで、デフォルトネームスペースを後から作成することができます。
GS2TemplateFormatVersion: "2019-05-01" Globals: Alias: ApplicationUserName: default KeyNamespaceName: default KeyName: default DistributorNamespaceName: default GatewayNamespaceName: default JobQueueNamespaceName: default Resources: IdentifierApplicationUser: Type: GS2::Identifier::User Properties: Name: ${ApplicationUserName} IdentifierApplicationUserAttachPolicy: Type: GS2::Identifier::AttachSecurityPolicy Properties: UserName: ${ApplicationUserName} SecurityPolicyId: grn:gs2::system:identifier:securityPolicy:ApplicationAccess DependsOn: - IdentifierApplicationUser IdentifierApplicationIdentifier: Type: GS2::Identifier::Identifier Properties: UserName: ${ApplicationUserName} DependsOn: - IdentifierApplicationUser KeyNamespace: Type: GS2::Key::Namespace Properties: Name: ${KeyNamespaceName} Key: Type: GS2::Key::Key Properties: NamespaceName: ${KeyNamespaceName} Name: ${KeyName} DependsOn: - KeyNamespace GatewayNamespace: Type: GS2::Gateway::Namespace Properties: Name: ${GatewayNamespaceName} DistributorNamespace: Type: GS2::Distributor::Namespace Properties: Name: ${DistributorNamespaceName} AutoRunStampSheetNotification: GatewayNamespaceId: !GetAttr GatewayNamespace.Item.NamespaceId JobQueueNamespace: Type: GS2::JobQueue::Namespace Properties: Name: ${JobQueueNamespaceName} EnableAutoRun: true Outputs: ApplicationClientId: !GetAttr IdentifierApplicationIdentifier.Item.ClientId ApplicationClientSecret: !GetAttr IdentifierApplicationIdentifier.ClientSecret
あとは、GS2-SDK を更新してください。Unity の場合は「v2023.11.7」以降を利用するようにしてください。