createGameSessionQueue method

Future<CreateGameSessionQueueOutput> createGameSessionQueue({
  1. required String name,
  2. String? customEventData,
  3. List<GameSessionQueueDestination>? destinations,
  4. FilterConfiguration? filterConfiguration,
  5. String? notificationTarget,
  6. List<PlayerLatencyPolicy>? playerLatencyPolicies,
  7. PriorityConfiguration? priorityConfiguration,
  8. List<Tag>? tags,
  9. int? timeoutInSeconds,
})

This API works with the following fleet types: EC2, Anywhere, Container

Creates a placement queue that processes requests for new game sessions. A queue uses FleetIQ algorithms to locate the best available placement locations for a new game session, and then prompts the game server process to start a new game session.

A game session queue is configured with a set of destinations (Amazon GameLift Servers fleets or aliases) that determine where the queue can place new game sessions. These destinations can span multiple Amazon Web Services Regions, can use different instance types, and can include both Spot and On-Demand fleets. If the queue includes multi-location fleets, the queue can place game sessions in any of a fleet's remote locations.

You can configure a queue to determine how it selects the best available placement for a new game session. Queues can prioritize placement decisions based on a combination of location, hosting cost, and player latency. You can set up the queue to use the default prioritization or provide alternate instructions using PriorityConfiguration.

Request options

Use this operation to make these common types of requests.

  • Create a queue with the minimum required parameters.
    • Name
    • Destinations (This parameter isn't required, but a queue can't make placements without at least one destination.)
  • Create a queue with placement notification. Queues that have high placement activity must use a notification system, such as with Amazon Simple Notification Service (Amazon SNS) or Amazon CloudWatch.
    • Required parameters Name and Destinations
    • NotificationTarget
  • Create a queue with custom prioritization settings. These custom settings replace the default prioritization configuration for a queue.
    • Required parameters Name and Destinations
    • PriorityConfiguration
  • Create a queue with special rules for processing player latency data.
    • Required parameters Name and Destinations
    • PlayerLatencyPolicies
Results

If successful, this operation returns a new GameSessionQueue object with an assigned queue ARN. Use the queue's name or ARN when submitting new game session requests with StartGameSessionPlacement or StartMatchmaking.

Learn more

Design a game session queue

Create a game session queue

Related actions

CreateGameSessionQueue | DescribeGameSessionQueues | UpdateGameSessionQueue | DeleteGameSessionQueue | All APIs by task

May throw InternalServiceException. May throw InvalidRequestException. May throw LimitExceededException. May throw NotFoundException. May throw TaggingFailedException. May throw UnauthorizedException.

Parameter name : A descriptive label that is associated with game session queue. Queue names must be unique within each Region.

Parameter customEventData : Information to be added to all events that are related to this game session queue.

Parameter destinations : A list of fleets and/or fleet aliases that can be used to fulfill game session placement requests in the queue. Destinations are identified by either a fleet ARN or a fleet alias ARN, and are listed in order of placement preference.

Parameter filterConfiguration : A list of locations where a queue is allowed to place new game sessions. Locations are specified in the form of Amazon Web Services Region codes, such as us-west-2. If this parameter is not set, game sessions can be placed in any queue location.

Parameter notificationTarget : An SNS topic ARN that is set up to receive game session placement notifications. See Setting up notifications for game session placement.

Parameter playerLatencyPolicies : A set of policies that enforce a sliding cap on player latency when processing game sessions placement requests. Use multiple policies to gradually relax the cap over time if Amazon GameLift Servers can't make a placement. Policies are evaluated in order starting with the lowest maximum latency value.

Parameter priorityConfiguration : Custom settings to use when prioritizing destinations and locations for game session placements. 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.

Parameter tags : A list of labels to assign to the new game session queue resource. Tags are developer-defined key-value pairs. Tagging Amazon Web Services resources are useful for resource management, access management and cost allocation. For more information, see Tagging Amazon Web Services Resources in the Amazon Web Services General Reference.

Parameter timeoutInSeconds : The maximum time, in seconds, that a new game session placement request remains in the queue. When a request exceeds this time, the game session placement changes to a TIMED_OUT status. If you don't specify a request timeout, the queue uses a default value.

Implementation

Future<CreateGameSessionQueueOutput> createGameSessionQueue({
  required String name,
  String? customEventData,
  List<GameSessionQueueDestination>? destinations,
  FilterConfiguration? filterConfiguration,
  String? notificationTarget,
  List<PlayerLatencyPolicy>? playerLatencyPolicies,
  PriorityConfiguration? priorityConfiguration,
  List<Tag>? tags,
  int? timeoutInSeconds,
}) async {
  _s.validateNumRange(
    'timeoutInSeconds',
    timeoutInSeconds,
    0,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GameLift.CreateGameSessionQueue'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      if (customEventData != null) 'CustomEventData': customEventData,
      if (destinations != null) 'Destinations': destinations,
      if (filterConfiguration != null)
        'FilterConfiguration': filterConfiguration,
      if (notificationTarget != null)
        'NotificationTarget': notificationTarget,
      if (playerLatencyPolicies != null)
        'PlayerLatencyPolicies': playerLatencyPolicies,
      if (priorityConfiguration != null)
        'PriorityConfiguration': priorityConfiguration,
      if (tags != null) 'Tags': tags,
      if (timeoutInSeconds != null) 'TimeoutInSeconds': timeoutInSeconds,
    },
  );

  return CreateGameSessionQueueOutput.fromJson(jsonResponse.body);
}