use of org.apache.camel.component.aws.sqs.SqsConfiguration in project syndesis by syndesisio.
the class AWSSQSVerifierExtension method verifyConnectivity.
// *********************************
// Connectivity validation
// *********************************
@Override
protected Result verifyConnectivity(Map<String, Object> parameters) {
ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.CONNECTIVITY);
try {
SqsConfiguration configuration = setProperties(new SqsConfiguration(), parameters);
AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);
AmazonSQS client = AmazonSQSClientBuilder.standard().withCredentials(credentialsProvider).withRegion(Regions.valueOf(configuration.getRegion())).build();
client.listQueues();
} catch (SdkClientException e) {
ResultErrorBuilder errorBuilder = ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION, e.getMessage()).detail("aws_sqs_exception_message", e.getMessage()).detail(VerificationError.ExceptionAttribute.EXCEPTION_CLASS, e.getClass().getName()).detail(VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE, e);
builder.error(errorBuilder.build());
} catch (Exception e) {
builder.error(ResultErrorBuilder.withException(e).build());
}
return builder.build();
}
use of org.apache.camel.component.aws.sqs.SqsConfiguration in project opentelemetry-java-instrumentation by open-telemetry.
the class CamelPropagationUtilTest method shouldNotFailExtractingNullAwsParentForSqsEndpoint.
@Test
public void shouldNotFailExtractingNullAwsParentForSqsEndpoint() {
// given
Endpoint endpoint = new SqsEndpoint("", new SqsComponent(), new SqsConfiguration());
Map<String, Object> exchangeHeaders = Collections.singletonMap("AWSTraceHeader", null);
// when
Context parent = CamelPropagationUtil.extractParent(exchangeHeaders, endpoint);
// then
Span parentSpan = Span.fromContext(parent);
SpanContext parentSpanContext = parentSpan.getSpanContext();
assertThat(parentSpanContext.isValid()).isEqualTo(false);
}
use of org.apache.camel.component.aws.sqs.SqsConfiguration in project opentelemetry-java-instrumentation by open-telemetry.
the class CamelPropagationUtilTest method shouldExtractAwsParentForSqsEndpoint.
@Test
public void shouldExtractAwsParentForSqsEndpoint() {
// given
Endpoint endpoint = new SqsEndpoint("", new SqsComponent(), new SqsConfiguration());
Map<String, Object> exchangeHeaders = Collections.singletonMap("AWSTraceHeader", "Root=1-5759e988-bd862e3fe1be46a994272793;Parent=53995c3f42cd8ad8;Sampled=1\n");
// when
Context parent = CamelPropagationUtil.extractParent(exchangeHeaders, endpoint);
// then
Span parentSpan = Span.fromContext(parent);
SpanContext parentSpanContext = parentSpan.getSpanContext();
assertThat(parentSpanContext.getTraceId()).isEqualTo("5759e988bd862e3fe1be46a994272793");
assertThat(parentSpanContext.getSpanId()).isEqualTo("53995c3f42cd8ad8");
}
Aggregations