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
250
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
Netty - Montreal Java User Group 2024-05-21
sullis
0
99
Netty Chicago Java User Group 2024-04-17
sullis
0
470
Java 21 - Portland Java User Group 2023-10-24
sullis
0
250
Microbenchmarking with JMH - Portland 2023-03-14
sullis
0
120
Code generation on the Java VM 2022-04-19
sullis
0
90
Mockito 2022-01-25
sullis
0
160
GitHub Actions 2021-12-16
sullis
0
33
Apache Struts and the Equifax data breach 2021-06-03
sullis
0
48
Guardrail State of the Union 2021-04-13
sullis
0
300
Other Decks in Technology
See All in Technology
開発と事業を繋ぐ!SREのオブザーバビリティ戦略 ~ Developers Summit 2024 Summer ~
leveragestech
0
630
エンジニアリングマネージャーはどう学んでいくのか #devsumi / How Do Engineering Managers Continue to Learn and Grow?
expajp
4
1.3k
Luupの開発組織におけるインシデントマネジメントの変遷 ver.RoadtoSRENEXT2024
grimoh
1
270
頼られるのが大好きな 皆さんへ - 支援相手との期待の合わせ方、突き放し方 -/For_people_who_like_to_be_relied_on
naitosatoshi
1
290
目標設定は好きですか? アジャイルとともに目標と向き合い続ける方法 / Do you like target Management?
kakehashi
10
3k
How to Think Like a Performance Engineer
csswizardry
4
590
VPoEの視点から見た、ヘンリーがサーバーサイドKotlinを使う理由 / Why Server-side Kotlin 2024
cho0o0
1
420
ペパボのオブザーバビリティ研修2024 説明資料
kesompochy
0
1.1k
LLMアプリケーションの評価の実践と課題 ~PharmaXにおける今後の展望~
pharma_x_tech
2
170
Classmethod Odyssey 登壇資料
yamahiro
0
390
「我々はどこに向かっているのか」を問い続けるための仕組みづくり / Establishing a System for Continuous Inquiry about where we are
daitasu
0
170
初中級者用如何使用backlog -VALE TUDOEDITION-
in0u
0
140
Featured
See All Featured
What the flash - Photography Introduction
edds
65
11k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
248
20k
A designer walks into a library…
pauljervisheath
201
24k
Become a Pro
speakerdeck
PRO
15
4.8k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Docker and Python
trallard
37
2.9k
Into the Great Unknown - MozCon
thekraken
20
1.3k
Ruby is Unlike a Banana
tanoku
96
10k
Designing Experiences People Love
moore
136
23k
Art, The Web, and Tiny UX
lynnandtonic
291
20k
Fantastic passwords and where to find them - at NoRuKo
philnash
42
2.7k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
662
120k
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