Skip to content

Commit 1c6e5f0

Browse files
committed
Merge branch 'master' into lambda
2 parents 2895481 + a949ae3 commit 1c6e5f0

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ The `master` branch shows the use of Spring, Angular, nginx, the [AWS SDK for Ja
6969
Other branches extend the application's functionality and show the use of other AWS services. See the readme in each branch for details about the integration and instructions for use.
7070

7171
**Branches**
72-
- [`cognito`](https://github.com/awslabs/eb-java-scorekeep/tree/cognito) - Support login and store users in an [Amazon Cognito](http://aws.amazon.com/cognito) user pool.
72+
- [`cognito`](https://github.com/awslabs/eb-java-scorekeep/tree/cognito) - Support login and store users in an [Amazon Cognito](http://aws.amazon.com/cognito) user pool. Get AWS SDK credentials and make service calls with a Cognito identity pool.
73+
- [`cognito-basic`](https://github.com/awslabs/eb-java-scorekeep/tree/cognito-basic) - Use Cognito for user ID storage. User pool only, no identity pool.
7374
- [`lambda`](https://github.com/awslabs/eb-java-scorekeep/tree/lambda) - Call an [AWS Lambda](http://aws.amazon.com/lambda) function to generate random names.
7475
- [`sql`](https://github.com/awslabs/eb-java-scorekeep/tree/sql) - Use JDBC to store game histories in an attached PostgreSQL database instance.
75-
- [`xray`](https://github.com/awslabs/eb-java-scorekeep/tree/xray) - Use the [AWS X-Ray SDK for Java](http://docs.aws.amazon.com/xray-sdk-for-java/latest/javadoc/) to instrument incoming requests, SDK clients, SQL queries, HTTP clients, and sections of code.
76+
- [`xray`](https://github.com/awslabs/eb-java-scorekeep/tree/xray) - Use the [AWS X-Ray SDK for Java](http://docs.aws.amazon.com/xray-sdk-for-java/latest/javadoc/) to instrument incoming requests, functions, SDK clients, SQL queries, HTTP clients, startup code, and AWS Lambda functions.
77+
- [`xray-cognito`](https://github.com/awslabs/eb-java-scorekeep/tree/xray-cognito) - Use AWS credentials obtained with Amazon Cognito to upload trace data to X-Ray from the browser.
7678
- [`xray-gettingstarted`](https://github.com/awslabs/eb-java-scorekeep/tree/xray-gettingstarted) ([tutorial](https://docs.aws.amazon.com/xray/latest/devguide/xray-gettingstarted.html)) - Use the AWS X-Ray SDK for Java to instrument incoming requests and SDK clients (no additional configuration required).
7779

7880
Use the procedures in the following sections to run the project on Elastic Beanstalk and configure it for local testing and development.
@@ -126,7 +128,7 @@ Deploy the source code for the project to your Elastic Beanstalk environment.
126128

127129
**To deploy the source code**
128130

129-
1. Download the source bundle: [eb-java-scorekeep-v1.zip](https://github.com/awslabs/eb-java-scorekeep/releases/download/v1.3/eb-java-scorekeep-v1.zip)
131+
1. Download the source bundle: [eb-java-scorekeep-v1.zip](https://github.com/awslabs/eb-java-scorekeep/releases/download/v1.5/eb-java-scorekeep-v1.zip)
130132
2. Open the [Elastic Beanstalk console](console.aws.amazon.com/elasticbeanstalk/home).
131133
3. Choose your environment's name to open the Dashboard.
132134
4. Choose **Upload and Deploy**.

public/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<title>Scorekeep</title>
55
<meta charset="utf-8"/>
66
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
7-
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-route.js"></script>
8-
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-resource.js"></script>
7+
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-route.js"></script>
8+
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-resource.js"></script>
99
<script src="app/scorekeep.js"></script>
1010
<script src="app/routes.js"></script>
1111
<script src="app/services.js"></script>

src/main/java/scorekeep/MoveFactory.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
import java.util.List;
55
import java.util.Set;
66
import java.lang.Class;
7+
import java.lang.Thread;
78
import java.lang.reflect.Method;
89
import java.lang.reflect.InvocationTargetException;
10+
911
import org.slf4j.Logger;
1012
import org.slf4j.LoggerFactory;
1113

@@ -16,7 +18,7 @@ public class MoveFactory {
1618
private final StateModel stateModel = new StateModel();
1719
private final GameController gameController = new GameController();
1820
private final StateController stateController = new StateController();
19-
private final RulesFactory rulesFactory = new RulesFactory();
21+
private final RulesFactory rulesFactory = new RulesFactory();
2022

2123
public MoveFactory(){
2224
}
@@ -58,7 +60,12 @@ public Move newMove(String sessionId, String gameId, String userId, String moveT
5860
State newState = new State(stateId, sessionId, gameId, newStateText, newTurn);
5961
// send notification on game end
6062
if ( newStateText.startsWith("A") || newStateText.startsWith("B")) {
61-
Sns.sendNotification("Scorekeep game completed", "Winner: " + userId);
63+
Thread comm = new Thread() {
64+
public void run() {
65+
Sns.sendNotification("Scorekeep game completed", "Winner: " + userId);
66+
}
67+
};
68+
comm.start();
6269
}
6370
// register state and move id to game
6471
gameController.setGameMove(sessionId, gameId, moveId);

src/main/java/scorekeep/UserFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public String randomName() throws IOException {
5656
Map<String, String> jsonMap = mapper.readValue(inputStream, Map.class);
5757
String name = jsonMap.get("name");
5858
EntityUtils.consume(entity);
59+
Sns.sendNotification("Scorekeep user created", "Name: " + name);
5960
return name;
6061
} finally {
6162
response.close();

src/main/java/scorekeep/WebConfig.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ public Filter SimpleCORSFilter() {
1717

1818
static {
1919
if ( System.getenv("NOTIFICATION_EMAIL") != null ){
20-
Sns.createSubscription();
20+
try { Sns.createSubscription(); }
21+
catch (Exception e ) {
22+
logger.warn("Failed to create subscription for email "+ System.getenv("NOTIFICATION_EMAIL"));
23+
}
2124
}
2225
}
2326
}

0 commit comments

Comments
 (0)