Search in sources :

Example 1 with VisibleForTesting

use of org.msgpack.core.annotations.VisibleForTesting in project fluency by komamitsu.

the class AwsS3Sender method buildClient.

@VisibleForTesting
protected S3Client buildClient(S3ClientBuilder s3ClientBuilder) {
    if (config.getEndpoint() != null) {
        try {
            URI uri = new URI(config.getEndpoint());
            s3ClientBuilder.endpointOverride(uri);
        } catch (URISyntaxException e) {
            throw new NonRetryableException(String.format("Invalid endpoint. %s", config.getEndpoint()), e);
        }
    }
    if (config.getRegion() != null) {
        s3ClientBuilder.region(Region.of(config.getRegion()));
    }
    if (config.getAwsAccessKeyId() != null && config.getAwsSecretAccessKey() != null) {
        AwsBasicCredentials credentials = AwsBasicCredentials.create(config.getAwsAccessKeyId(), config.getAwsSecretAccessKey());
        s3ClientBuilder.credentialsProvider(StaticCredentialsProvider.create(credentials));
    }
    return s3ClientBuilder.build();
}
Also used : NonRetryableException(org.komamitsu.fluency.NonRetryableException) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) AwsBasicCredentials(software.amazon.awssdk.auth.credentials.AwsBasicCredentials) VisibleForTesting(org.msgpack.core.annotations.VisibleForTesting)

Example 2 with VisibleForTesting

use of org.msgpack.core.annotations.VisibleForTesting in project fluency by komamitsu.

the class FluencyBuilder method createFluency.

@VisibleForTesting
public Fluency createFluency(RecordFormatter recordFormatter, Ingester ingester, Buffer.Config bufferConfig, Flusher.Config flusherConfig) {
    Buffer buffer = new Buffer(bufferConfig, recordFormatter);
    Flusher flusher = new Flusher(flusherConfig, buffer, ingester);
    return new Fluency(buffer, flusher);
}
Also used : Buffer(org.komamitsu.fluency.buffer.Buffer) Flusher(org.komamitsu.fluency.flusher.Flusher) VisibleForTesting(org.msgpack.core.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (org.msgpack.core.annotations.VisibleForTesting)2 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 NonRetryableException (org.komamitsu.fluency.NonRetryableException)1 Buffer (org.komamitsu.fluency.buffer.Buffer)1 Flusher (org.komamitsu.fluency.flusher.Flusher)1 AwsBasicCredentials (software.amazon.awssdk.auth.credentials.AwsBasicCredentials)1