AWS SDK for Java version 2.0 - Portland Oregon

99d4c0ed3c8027ea1c37b53d6441d042?s=47 sullis
August 28, 2018

AWS SDK for Java version 2.0 - Portland Oregon

Portland Java User Group
Portland Oregon
August 28, 2018

99d4c0ed3c8027ea1c37b53d6441d042?s=128

sullis

August 28, 2018
Tweet

Transcript

  1. Sean Sullivan August 28, 2018 Portland Java User Group AWS

    SDK for Java version 2.0
  2. software engineer 22 years on the JVM Portland Oregon back

    office systems Hudson’s Bay Company About me
  3. Agenda Hudson’s Bay Company SDK for Java • version 1.x

    • version 2.x Scala and AWS
  4. https://en.wikipedia.org/wiki/Hudson%27s_Bay_Company

  5. Toronto NYC

  6. saksfifthavenue.com saksoff5th.com lordandtaylor.com thebay.com

  7. saksfifthavenue.com

  8. walmart.com

  9. HBC Tech stack

  10. Web Checkout Android Checkout iPhone Checkout Checkout service

  11. AWS SDK for Java

  12. SDK v2 announced June 2017 @awsforjava

  13. “Under the hood, we use an HTTP client built on

    top of Netty to make the non- blocking HTTP call” “first class support for non-blocking I/O in our async clients” source: AWS Developer Blog
  14. import java.util.concurrent.CompletableFuture; DynamoDBAsyncClient client = DynamoDBAsyncClient.builder() .region(Region.US_WEST_2) .build(); CompletableFuture<ListTablesResponse> response

    = client.listTables(ListTablesRequest.builder().build()); CompletableFuture<List<String>> tableNames = response.thenApply(ListTablesResponse::tableNames); tableNames.whenComplete((tables, err) -> { if (tables != null) { tables.forEach(System.out::println); } else { err.printStackTrace(); } }); SDK v2
  15. Github projects aws-sdk-java aws-sdk-java-v2

  16. SDK v2 Developer Preview

  17. Pull Request

  18. $ cd aws-sdk-java-v2 $ git log | grep 'Author: Sean

    Sullivan' | wc -l 39
  19. SDK v2 Maven artifacts

  20. https://search.maven.org/

  21. <dependency> <groupId>com.amazonaws<groupId> <artifactId>aws-java-sdk-dynamodb</artifactId> <version>1.11.397</version> </dependency> Maven dependencies SDK v1 <dependency>

    <groupId>software.amazon.awssdk<groupId> <artifactId>dynamodb</artifactId> <version>2.0.1</version> </dependency> SDK v2
  22. import com.amazonaws.services.cloudwatch.AmazonCloudWatchClient; import com.amazonaws.services.cloudwatch.AmazonCloudWatchClientBuilder; import com.amazonaws.services.cloudwatch.model.MetricDatum; import com.amazonaws.services.cloudwatch.model.PutMetricDataRequest; Java packages

    SDK v1 import software.amazon.awssdk.services.cloudwatch.CloudWatchAsyncClient; import software.amazon.awssdk.services.cloudwatch.model.MetricDatum; import software.amazon.awssdk.services.cloudwatch.model.PutMetricDataRequest; SDK v2
  23. distinct Maven artifact names distinct Java package names SDK v2

    and SDK v1 can co-exist in a Java application SDK v1 jar SDK v2 jar
  24. SDK v2 programming API • Immutable clients and models •

    Enhanced pagination • Smart configuration merging • Forward-compatible enums • Streaming operations as first-class concepts
  25. AWS SDK v2 in a Scala application?

  26. val awsSdkVersion = “2.0.1" "org.scala-lang.modules" %% "scala-java8-compat" % “0.9.0", "software.amazon.awssdk"

    % "cloudwatch" % awsSdkVersion, "software.amazon.awssdk" % "dynamodb" % awsSdkVersion build.sbt
  27. import scala.compat.java8.FutureConverters._ import scala.collection.JavaConverters._ Foo.scala

  28. FutureConverters?

  29. java.util.concurrent.CompletableFuture scala.concurrent.Future

  30. FutureConverters.scala

  31. gfc-aws-cloudwatch

  32. “A tiny Scala wrapper around AWS CloudWatch Java client” gfc-aws-cloudwatch

  33. https://github.com/gilt/gfc-aws-cloudwatch

  34. how to migrate gfc-aws-cloudwatch from SDK v1 to SDK v2

    ?
  35. https://github.com/ gilt/gfc-aws- cloudwatch/pull/8/ files

  36. Conclusion SDK v1 — production ready SDK v2 — coming

    soon github.com/aws twitter.com/awsforjava
  37. The end

  38. None
  39. Bonus material

  40. “Developing Applications on AWS in the JVM” AWS re:Invent 2017

  41. https://www.slideshare.net/AmazonWebServices/ dev205developing-applications-on-aws-in-the-jvm