Skip to content

Commit

Permalink
Improve Readme examples and fix typo on Error text
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehouel committed Dec 8, 2022
1 parent fb91fdd commit 93b5ffd
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
32 changes: 32 additions & 0 deletions packages/@aws-cdk/aws-gamelift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,38 @@ const queue = new gamelift.GameSessionQueue(this, 'GameSessionQueue', {
queue.addDestination(alias);
```

A more complex configuration can also be definied to override how FleetIQ algorithms prioritize game session placement in order to favour a destination based on `Cost`, `Latency`, `Destination order`or `Location`.

```ts
declare const fleet: gamelift.BuildFleet;
declare const topic: sns.Topic;

new gamelift.GameSessionQueue(this, 'MyGameSessionQueue', {
gameSessionQueueName: 'test-gameSessionQueue',
customEventData: 'test-event-data',
allowedLocations: ['eu-west-1', 'eu-west-2'],
destinations: [fleet],
notificationTarget: topic,
playerLatencyPolicies: [{
maximumIndividualPlayerLatency: Duration.millis(100),
policyDuration: Duration.seconds(300),
}],
priorityConfiguration: {
locationOrder: [
'eu-west-1',
'eu-west-2',
],
priorityOrder: [
gamelift.PriorityType.LATENCY,
gamelift.PriorityType.COST,
gamelift.PriorityType.DESTINATION,
gamelift.PriorityType.LOCATION,
],
},
timeout: Duration.seconds(300),
});
```

See [Setting up GameLift queues for game session placement](https://docs.aws.amazon.com/gamelift/latest/developerguide/realtime-script-uploading.html)
in the *Amazon GameLift Developer Guide*.

Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-gamelift/lib/game-session-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ export class GameSessionQueue extends GameSessionQueueBase {
}

if (props.customEventData && props.customEventData.length > 256) {
throw new Error(`GameSessionQueue cudtom event data can not be longer than 256 characters but has ${props.customEventData.length} characters.`);
throw new Error(`GameSessionQueue custom event data can not be longer than 256 characters but has ${props.customEventData.length} characters.`);
}

if (props.allowedLocations && props.allowedLocations.length > 100) {
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-gamelift/rosetta/default.ts-fixture
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Duration, Size, Stack, CfnOutput } from '@aws-cdk/core';
import * as gamelift from '@aws-cdk/aws-gamelift';
import * as s3 from '@aws-cdk/aws-s3';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as sns from '@aws-cdk/aws-sns';
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
import * as iam from '@aws-cdk/aws-iam';
import * as path from 'path';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ describe('gameSessionQueue', () => {
gameSessionQueueName: 'test-name',
destinations: [fleet],
customEventData: incorrectCustomEventData,
})).toThrow(/GameSessionQueue cudtom event data can not be longer than 256 characters but has 257 characters./);
})).toThrow(/GameSessionQueue custom event data can not be longer than 256 characters but has 257 characters./);
});

test('with an incorrect number of locations', () => {
Expand Down

0 comments on commit 93b5ffd

Please sign in to comment.