use of software.amazon.awssdk.services.kinesis.KinesisAsyncClientBuilder in project graylog-plugin-integrations by Graylog2.
the class KinesisConsumer method run.
public void run() {
LOG.debug("Starting the Kinesis Consumer.");
AwsCredentialsProvider credentialsProvider = AWSAuthFactory.create(request.region(), request.awsAccessKeyId(), request.awsSecretAccessKey(), request.assumeRoleArn());
final Region region = Region.of(request.region());
final DynamoDbAsyncClientBuilder dynamoDbClientBuilder = DynamoDbAsyncClient.builder();
AWSClientBuilderUtil.initializeBuilder(dynamoDbClientBuilder, request.dynamodbEndpoint(), region, credentialsProvider);
final DynamoDbAsyncClient dynamoClient = dynamoDbClientBuilder.build();
final CloudWatchAsyncClientBuilder cloudwatchClientBuilder = CloudWatchAsyncClient.builder();
AWSClientBuilderUtil.initializeBuilder(cloudwatchClientBuilder, request.cloudwatchEndpoint(), region, credentialsProvider);
final CloudWatchAsyncClient cloudWatchClient = cloudwatchClientBuilder.build();
final KinesisAsyncClientBuilder kinesisAsyncClientBuilder = KinesisAsyncClient.builder();
AWSClientBuilderUtil.initializeBuilder(kinesisAsyncClientBuilder, request.kinesisEndpoint(), region, credentialsProvider);
final KinesisAsyncClient kinesisAsyncClient = KinesisClientUtil.createKinesisAsyncClient(kinesisAsyncClientBuilder);
final String workerId = String.format(Locale.ENGLISH, "graylog-node-%s", nodeId.anonymize());
LOG.debug("Using workerId [{}].", workerId);
// The application name needs to be unique per input/consumer.
final String applicationName = String.format(Locale.ENGLISH, "graylog-aws-plugin-%s", kinesisStreamName);
LOG.debug("Using Kinesis applicationName [{}].", applicationName);
// The KinesisShardProcessorFactory contains the message processing logic.
final KinesisShardProcessorFactory kinesisShardProcessorFactory = new KinesisShardProcessorFactory(objectMapper, transport, handleMessageCallback, kinesisStreamName, awsMessageType);
ConfigsBuilder configsBuilder = new ConfigsBuilder(kinesisStreamName, applicationName, kinesisAsyncClient, dynamoClient, cloudWatchClient, workerId, kinesisShardProcessorFactory);
final PollingConfig pollingConfig = new PollingConfig(kinesisStreamName, kinesisAsyncClient);
// Default max records per request is 10k.
if (recordBatchSize != null) {
LOG.debug("Using explicit batch size [{}]", recordBatchSize);
pollingConfig.maxRecords(recordBatchSize);
}
this.kinesisScheduler = new Scheduler(configsBuilder.checkpointConfig(), configsBuilder.coordinatorConfig(), configsBuilder.leaseManagementConfig(), configsBuilder.lifecycleConfig(), configsBuilder.metricsConfig(), configsBuilder.processorConfig(), configsBuilder.retrievalConfig().retrievalSpecificConfig(pollingConfig));
LOG.debug("Starting Kinesis scheduler.");
kinesisScheduler.run();
LOG.debug("After Kinesis scheduler stopped.");
}
use of software.amazon.awssdk.services.kinesis.KinesisAsyncClientBuilder in project aws-sdk by reactiverse.
the class VertxKinesisClientSpec method kinesis.
private KinesisAsyncClient kinesis(Context context) throws Exception {
final URI kinesisURI = new URI(Localstack.INSTANCE.getEndpointKinesis());
final KinesisAsyncClientBuilder builder = KinesisAsyncClient.builder().region(Region.EU_WEST_1).endpointOverride(kinesisURI).credentialsProvider(credentialsProvider);
return VertxSdkClient.withVertx(builder, context).build();
}
use of software.amazon.awssdk.services.kinesis.KinesisAsyncClientBuilder in project pulsar by apache.
the class KinesisSourceConfig method buildKinesisAsyncClient.
public KinesisAsyncClient buildKinesisAsyncClient(AwsCredentialProviderPlugin credPlugin) {
KinesisAsyncClientBuilder builder = KinesisAsyncClient.builder();
if (!this.getAwsEndpoint().isEmpty()) {
builder.endpointOverride(URI.create(this.getAwsEndpoint()));
}
if (!this.getAwsRegion().isEmpty()) {
builder.region(this.regionAsV2Region());
}
builder.credentialsProvider(credPlugin.getV2CredentialsProvider());
return KinesisClientUtil.createKinesisAsyncClient(builder);
}
use of software.amazon.awssdk.services.kinesis.KinesisAsyncClientBuilder in project micronaut-aws-sdk by agorapulse.
the class KinesisFactory method kinesisAsync.
@Singleton
@Bean(preDestroy = "close")
@EachBean(KinesisConfiguration.class)
KinesisAsyncClient kinesisAsync(KinesisConfiguration configuration, AwsCredentialsProvider credentialsProvider, AwsRegionProvider awsRegionProvider, Optional<SdkAsyncHttpClient> httpClient) {
KinesisAsyncClientBuilder builder = KinesisAsyncClient.builder().credentialsProvider(credentialsProvider);
configuration.configure(builder, awsRegionProvider);
httpClient.ifPresent(builder::httpClient);
return builder.build();
}
use of software.amazon.awssdk.services.kinesis.KinesisAsyncClientBuilder in project aws-sdk by reactiverse.
the class ProxyTest method testGetThroughProxy.
@Test
@Timeout(value = 15, timeUnit = TimeUnit.SECONDS)
public void testGetThroughProxy(VertxTestContext ctx) throws Exception {
final KinesisAsyncClientBuilder builder = KinesisAsyncClient.builder().region(Region.EU_WEST_1).endpointOverride(// something that just doesn't exist, the only thing that matters is that every request has traveled through proxy
new URI("http://localhost:1111")).credentialsProvider(credentialsProvider);
HttpClientOptions throughProxyOptions = new HttpClientOptions().setProxyOptions(new ProxyOptions().setHost(PROXY_HOST).setPort(PROXY_PORT));
KinesisAsyncClient kinesis = VertxSdkClient.withVertx(builder, throughProxyOptions, vertx.getOrCreateContext()).build();
assertEquals(proxyAccess.get(), 0, "Proxy access count should have been reset");
kinesis.listStreams().handle((res, err) -> {
assertTrue(proxyAccess.get() > 0, "Requests should have been transferred through proxy");
ctx.completeNow();
return null;
});
}
Aggregations