> **Experimental**
>
> `@aws-cdk/aws-gamelift-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# GameSessionQueue

The GameSessionQueue resource creates a placement queue that processes requests for new game sessions.

A queue uses FleetIQ algorithms to determine the best placement locations and find an available game server, then prompts the game server to start a new game session.
Queues can have destinations (GameLift fleets or gameSessionQueuees), which determine where the queue can place new game sessions.
A queue can have destinations with varied fleet type (Spot and On-Demand), instance type, and AWS Region.

Extends: Construct › Resource › GameSessionQueueBase › GameSessionQueue
Implements: IGameSessionQueue, IResource, IEnvironmentAware, IConstruct, IDependable

- Stability: [Experimental](/cdk/api/stability.html)
- CloudFormation: [`AWS::GameLift::GameSessionQueue`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-gamelift-gamesessionqueue.html)
- L1 type: [`CfnGameSessionQueue`](/cdk/api/v2/docs/aws-cdk-lib.aws_gamelift.CfnGameSessionQueue.html)
- Source: [`lib/game-session-queue.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0-alpha.0/packages/@aws-cdk/aws-gamelift-alpha/lib/game-session-queue.ts#L305)

## Example

```ts
declare const fleet: gamelift.BuildFleet;
declare const alias: gamelift.Alias;

const queue = new gamelift.GameSessionQueue(this, 'GameSessionQueue', {
  gameSessionQueueName: 'my-queue-name',
  destinations: [fleet]
});
queue.addDestination(alias);
```

## Initializer

```ts
new GameSessionQueue(scope: Construct, id: string, props: GameSessionQueueProps)
```

## Construct Props

- `allowedLocations`: string[] — A list of locations where a queue is allowed to place new game sessions.

  **Default:** game sessions can be placed in any queue location

  Locations are specified in the form of AWS Region codes, such as `us-west-2`.

  For queues that have multi-location fleets, you can use a filter configuration allow placement with some, but not all of these locations.

- `customEventData`: string — Information to be added to all events that are related to this game session queue.

  **Default:** no customer event data

- `destinations`: [IGameSessionQueueDestination](/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IGameSessionQueueDestination.html)[] (required) — A list of fleets and/or fleet alias that can be used to fulfill game session placement requests in the queue.

  Destinations are listed in order of placement preference.

- `gameSessionQueueName`: string (required) — Name of this gameSessionQueue.

- `notificationTarget`: [ITopic](/cdk/api/v2/docs/aws-cdk-lib.aws_sns.ITopic.html) — An SNS topic is set up to receive game session placement notifications.

  **Default:** no notification

- `playerLatencyPolicies`: [PlayerLatencyPolicy](/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.PlayerLatencyPolicy.html)[] — A set of policies that act as a sliding cap on player latency.

  **Default:** no player latency policy

  FleetIQ works to deliver low latency for most players in a game session.
  These policies ensure that no individual player can be placed into a game with unreasonably high latency.
  Use multiple policies to gradually relax latency requirements a step at a time.
  Multiple policies are applied based on their maximum allowed latency, starting with the lowest value.

- `priorityConfiguration`: [PriorityConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.PriorityConfiguration.html) — Custom settings to use when prioritizing destinations and locations for game session placements.

  **Default:** no priority configuration

  This configuration replaces the FleetIQ default prioritization process.

  Priority types that are not explicitly named will be automatically applied at the end of the prioritization process.

- `timeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — The maximum time, that a new game session placement request remains in the queue.

  **Default:** 50 seconds

  When a request exceeds this time, the game session placement changes to a `TIMED_OUT` status.

## Properties

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) (required) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `gameSessionQueueArn`: string (required) — The ARN of the gameSessionQueue.

- `gameSessionQueueName`: string (required) — The name of the gameSessionQueue.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) (required) — The tree node.

- `PROPERTY_INJECTION_ID`: string (required) (static) — Uniquely identifies this class.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) (required) — The stack in which this resource is defined.

## Methods

- `addDestination(destination: IGameSessionQueueDestination): void` — Adds a destination to fulfill requests for new game sessions.

  **Parameters**

  - `destination` — A destination to add.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `fromGameSessionQueueArn(scope: Construct, id: string, gameSessionQueueArn: string): IGameSessionQueue` (static) — Import an existing gameSessionQueue from its ARN.

- `fromGameSessionQueueAttributes(scope: Construct, id: string, attrs: GameSessionQueueAttributes): IGameSessionQueue` (static) — Import an existing gameSessionQueue from its attributes.

- `fromGameSessionQueueName(scope: Construct, id: string, gameSessionQueueName: string): IGameSessionQueue` (static) — Import an existing gameSessionQueue from its name.

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `metric(metricName: string, props?: MetricOptions): Metric` — Return the given named metric for this fleet.

- `metricAverageWaitTime(props?: MetricOptions): Metric` — Average amount of time that game session placement requests in the queue with status PENDING have been waiting to be fulfilled.

- `metricPlacementsCanceled(props?: MetricOptions): Metric` — Game session placement requests that were canceled before timing out since the last report.

- `metricPlacementsFailed(props?: MetricOptions): Metric` — Game session placement requests that failed for any reason since the last report.

- `metricPlacementsStarted(props?: MetricOptions): Metric` — New game session placement requests that were added to the queue since the last report.

- `metricPlacementsSucceeded(props?: MetricOptions): Metric` — Game session placement requests that resulted in a new game session since the last report.

- `metricPlacementsTimedOut(props?: MetricOptions): Metric` — Game session placement requests that reached the queue's timeout limit without being fulfilled since the last report.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
