小编Mik*_*ike的帖子

如何配置 Sleuth 来跟踪 AWS SQS 队列

我正在尝试使用 Sleuth 跟踪 Spring Cloud 集成 aws + AWS SQS 应用程序。将消息添加到队列后,接收方从 SQS 接收消息。日志有应用程序名称,但从 sql 队列接收消息时没有跟踪 id 和跨度 id。这是日志中的一行:

2017-07-28 16:24:02.352 INFO [sqs-sleuth-demo,,,] 9706 --- [enerContainer-2] com.example.demo.SQSMessageReceiver:出队消息:hello world

我使用 Spring Boot '1.5.4.RELEASE' 和 Spring Cloud 'Dalston.SR1'。这是依赖项:

dependencies {

  compile("org.springframework.boot:spring-boot")
  compile("org.springframework.boot:spring-boot-starter")
  compile("org.springframework.boot:spring-boot-starter-web")

  compile("org.springframework.cloud:spring-cloud-aws-messaging")
  compile("org.springframework.cloud:spring-cloud-aws-autoconfigure")
  compile('org.springframework.cloud:spring-cloud-starter-sleuth')
  compile("org.springframework.integration:spring-integration-aws:1.0.0.RELEASE")

  compile("com.amazonaws:aws-java-sdk-sqs")
}

dependencyManagement {
  imports {
    mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
  }
}
Run Code Online (Sandbox Code Playgroud)

应用程序配置.java

@Configuration
public class AppConfig {

  @Value("${amazon.aws.accesskey}")
  private String amazonAWSAccessKey;

  @Value("${amazon.aws.secretkey}")
  private String amazonAWSSecretKey;

  @Value("${amazon.sqs.endpoint}")
  private String amazonSqsEndpoint;

  @Value("${cloud.aws.region.static}")
  private String awsRegion;

  @Bean
  @Primary
  public AWSCredentialsProviderChain …
Run Code Online (Sandbox Code Playgroud)

amazon-sqs spring-cloud-aws spring-cloud-sleuth

7
推荐指数
0
解决办法
3156
查看次数