Is there any example code for Java

Hi need to write lambda function for Gamelift StartMatchMaking,

Is there any example code for gamlift, how to init and call functions?

Hi @VinK, Thanks for reaching out. Here’s the AWS document for the Java API:

Hi Junbo,

I meant by example code… something like below,

In my SAML app, I got maven dependency added

com.amazonaws aws-java-sdk-gamelift 1.11.831

But not sure where to go from there.

@VinK - theres a simple example here in .Net that should walk you through whats required and should be simple to convert to Java:

And this has python examples:

I’m not sure there is an existing up-to-date Java lambda example out there.

From memory (and I’m free typing this, so apologies for code mistakes), startMatchmaking is just a matter of packing up the request object (as with any other AWS call) ie:

public StartMatchmakingResult startMatchmaking( ... pass in what you need) {

        final String ticketId = randomUUID().toString();
        // Need to fill this with what you need
        Map<String,AttributeValue> attributes = Collections.emptyMap()

        try {
            return getClient(configuration).startMatchmaking(
                    new StartMatchmakingRequest()
                                            .map((id) -> new Player()
       // handle errors
        } catch (final NotFoundException  e) {
        } catch (final InvalidRequestException e) {

I would work out how to write/deploy the simplest Java lambda and build on its complexity from there ie start with describe-matchmaking or list-fleets for example.

Hope thats helpful