Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Log requests being made using RestTemplate clients to AWS DynamoDb

License

NotificationsYou must be signed in to change notification settings

actigence/resttemplate-request-logger

Repository files navigation

Java CI with Maven

This package can be used to log request and response details of API calls made using Spring RestTemplates.The logs are stored in AWS DynamoDB usingAPI Access Tracker (Backend).Please visitAPI Access Tracker (Backend) to setupAWS stack before using this package for logging your requests.

This package, provides a simple RestTemplate interceptor, to send request and response data to AWS stack using AWS SQS.

Usage

  1. Setup your AWS stack as shown inAPI Access Tracker (Backend).

  2. Include this package into your build:

  • For Maven builds add below dependency to your pom.xml.
<dependency>    <groupId>com.actigence</groupId>    <artifactId>resttemplate-request-logger</artifactId>    <version>0.0.1</version></dependency>
  • For Gradle add below dependency to yourbuild.gradle file
compile group: 'com.actigence', name: 'resttemplate-request-logger', version: '0.0.1'
  1. To add RestTemplate interceptor to your project, create the RestTemplate bean as shown below.
@ConfigurationpublicclassRestTemplateConfig {@BeanpublicRestTemplaterestTemplate() {ClientHttpRequestFactoryfactory =newBufferingClientHttpRequestFactory(newSimpleClientHttpRequestFactory());RestTemplaterestTemplate =newRestTemplate(factory);restTemplate.setInterceptors(singletonList(newOutboundRequestTrackingInterceptor()));returnrestTemplate;    }}
  1. Now whenever you access any URL using this RestTemplate bean.The request will be seamlessly intercepted by theOutboundRequestTrackingInterceptor class and an event will bepublished to the AWS SQS for storing that request and response.
Quotequote =restTemplate.getForObject("https://gturnquist-quoters.cfapps.io/api/random",Quote.class);
  1. Seeresttemplate-request-logger-demo for full example code.

About

Log requests being made using RestTemplate clients to AWS DynamoDb

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp