Created
September 26, 2016 17:05
-
-
Save ggarber/af69ffd9ea34a9f602ad2f97eff21cfa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I think ideally the RequestContext should not be a parameter in all the methods | |
// but i don't want to discuss that part right now | |
public void handleCreateRequests(RequestContext context, RaptorV2Message msg) { | |
Log.info("HandleCreateRequests", context); | |
Session session = getSession(msg.sessionId()); // <-- see it is not ctx.sessionId() | |
Connectino connection = getConnection(msg); | |
CompletableFuture.runAsync(() -> onSessionConnectRequest(context, session, connection), getExecutor(msg)); | |
} | |
public void onSessionConnectRequest(RequestContext context, Session session, Connection connection) { | |
Log.info("OnSessionConnectRequest", context); | |
CompletableFuture<Token> future = AnvilApi.validateToken(); | |
future.thenAsync(token -> handleSessionConnectRequest(context, session, connection), THIS_CONTEXT); | |
} | |
public void handleSessionConnectRequest(RequestContext context, Session session, Connection connection) { | |
Log.info("HandleSessionConnectRequest", context); | |
session.add(connection); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment