Created
April 26, 2019 08:54
-
-
Save Slakah/ec4fa411096070b2749a216248a109a5 to your computer and use it in GitHub Desktop.
Use AWS SDK V2 Kinesis with localstack.
This file contains hidden or 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
import $ivy.`software.amazon.awssdk:kinesis:2.5.31` | |
import $ivy.`software.amazon.awssdk:netty-nio-client:2.5.31` | |
def localAwsClient[Builder <: AwsClientBuilder[Builder, _]](builder: Builder, endpoint: String): Builder = { | |
val creds = AwsBasicCredentials.create("dummy", "dummy") | |
builder | |
.endpointOverride(URI.create(endpoint)) | |
.region(Region.US_EAST_1) | |
.credentialsProvider(StaticCredentialsProvider.create(creds)) | |
} | |
val kinesisClient = localAwsClient( | |
KinesisAsyncClient | |
.builder() | |
.httpClient(NettyNioAsyncHttpClient.builder().protocol(Protocol.HTTP1_1) | |
.buildWithDefaults( | |
AttributeMap | |
.builder() | |
.put(SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES, java.lang.Boolean.TRUE) | |
.build() | |
)), | |
"http://localhost:4568" | |
).build() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment