Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AWS SDK for Java version 2.0 - DAWSCON 2019
Search
sullis
January 11, 2019
Technology
0
280
AWS SDK for Java version 2.0 - DAWSCON 2019
DAWSCON 2019
Dawson College
Montreal Canada
January 11, 2019
sullis
January 11, 2019
Tweet
Share
More Decks by sullis
See All by sullis
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
140
Amazon S3 - Portland Java User Group 2024-09-17
sullis
0
68
Netty - Montreal Java User Group 2024-05-21
sullis
0
150
Netty Chicago Java User Group 2024-04-17
sullis
0
980
Java 21 - Portland Java User Group 2023-10-24
sullis
0
300
Microbenchmarking with JMH - Portland 2023-03-14
sullis
0
130
Code generation on the Java VM 2022-04-19
sullis
0
120
Mockito 2022-01-25
sullis
0
170
GitHub Actions 2021-12-16
sullis
0
40
Other Decks in Technology
See All in Technology
Creative Pair
kawaguti
PRO
1
140
Agentic AI時代のプロダクトマネジメントことはじめ〜仮説検証編〜
masakazu178
3
440
オーティファイ会社紹介資料 / Autify Company Deck
autifyhq
10
120k
CNAPPから考えるAWSガバナンスの実践と最適化
yuobayashi
5
700
Bounded Context: Problem or Solution?
ewolff
1
170
プロダクト価値を引き上げる、「課題の再定義」という習慣
moeka__c
0
210
例外処理を理解して、設計段階からエラーを「見つけやすく」「起こりにくく」する
kajitack
12
4.1k
自動と手動の両輪で開発するデータクレンジング
estie
2
110
GraphRAG: What I Thought I Knew (But Didn’t)
sashimimochi
1
240
プロダクト観点で考えるデータ基盤の育成戦略 / Growth Strategy of Data Analytics Platforms from a Product Perspective
yamamotoyuta
0
380
ChatGPTを使ったブログ執筆と校正の実践テクニック/登壇資料(井田 献一朗)
hacobu
1
170
Zenn のウラガワ ~エンジニアのアウトプットを支える環境で Google Cloud が採用されているワケ~ #burikaigi #burikaigi_h
kongmingstrap
19
7.1k
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
94
13k
We Have a Design System, Now What?
morganepeng
51
7.4k
Agile that works and the tools we love
rasmusluckow
328
21k
Git: the NoSQL Database
bkeepers
PRO
427
64k
BBQ
matthewcrist
86
9.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
620
Optimizing for Happiness
mojombo
376
70k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
Done Done
chrislema
182
16k
RailsConf 2023
tenderlove
29
980
Build The Right Thing And Hit Your Dates
maggiecrowley
34
2.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.2k
Transcript
Sean Sullivan January 11, 2019 DAWSCON AWS SDK for Java
version 2.0
software engineer Portland Oregon back office systems Hudson’s Bay Company
About me
Agenda Hudson’s Bay Company SDK for Java • version 1.x
• version 2.x Migrating code from V1 to V2
Toronto NYC
None
saksfifthavenue.com saksoff5th.com lordandtaylor.com thebay.com
thebay.com
walmart.com
HBC Tech stack
Web Checkout Android Checkout iPhone Checkout Checkout service
AWS SDK for Java
SDK v2 announced June 2017 @awsforjava
“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
“The AWS SDK for Java 2.0 asynchronous client methods return
CompletableFuture objects” source: SDK V2 Developer Guide
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
Github projects aws-sdk-java aws-sdk-java-v2
SDK v2
Pull Request
SDK v2 Maven artifacts
https://search.maven.org/
<dependency> <groupId>com.amazonaws<groupId> <artifactId>aws-java-sdk-dynamodb</artifactId> <version>1.11.481</version> </dependency> Maven dependencies SDK v1 <dependency>
<groupId>software.amazon.awssdk<groupId> <artifactId>dynamodb</artifactId> <version>2.3.0</version> </dependency> SDK v2
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
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
SDK v2 programming API • Immutable clients and models •
Enhanced pagination • Smart configuration merging • Forward-compatible enums • Streaming operations as first-class concepts
AWS SDK v2 in a Scala application?
val awsSdkVersion = “2.3.0” "org.scala-lang.modules" %% "scala-java8-compat" % “0.9.0", "software.amazon.awssdk"
% "cloudwatch" % awsSdkVersion, "software.amazon.awssdk" % "dynamodb" % awsSdkVersion build.sbt
import scala.compat.java8.FutureConverters._ import scala.collection.JavaConverters._ Foo.scala
FutureConverters?
java.util.concurrent.CompletableFuture scala.concurrent.Future
FutureConverters.scala
Migrating code from V1 to V2
gfc-aws-cloudwatch
“A tiny Scala wrapper around AWS CloudWatch Java client” gfc-aws-cloudwatch
https://github.com/gilt/gfc-aws-cloudwatch
how to migrate gfc-aws-cloudwatch from SDK v1 to SDK v2
?
https://github.com/ gilt/gfc-aws- cloudwatch/pull/8/ files
aws-secretsmanager-caching-java
“AWS Secrets Manager Java caching client enables in-process caching of
secrets for Java applications” aws-secretsmanager-caching-java
https://github.com/aws/aws-secretsmanager-caching-java/
https://github.com/aws/aws-secretsmanager-caching-java/issues/5
how to migrate aws-secretsmanager- caching-java from SDK v1 to SDK
v2 ?
https://github.com/ aws/aws- secretsmanager- caching-java/pull/6
https://github.com/aws/aws-secretsmanager-caching-java/pull/6/files
https://github.com/aws/aws-secretsmanager-caching-java/pull/6/files
Conclusion SDK v1 — production ready SDK v2 — production
ready github.com/aws twitter.com/awsforjava
The end
None
Bonus material
“Hands-on in the AWS Java Ecosystem” AWS re:Invent 2018
“Developing Applications on AWS in the JVM” AWS re:Invent 2017
https://www.slideshare.net/AmazonWebServices/ dev205developing-applications-on-aws-in-the-jvm