- Notifications
You must be signed in to change notification settings - Fork0
Log requests being made using RestTemplate clients to AWS DynamoDb
License
NotificationsYou must be signed in to change notification settings
actigence/resttemplate-request-logger
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
Setup your AWS stack as shown inAPI Access Tracker (Backend).
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 your
build.gradle
file
compile group: 'com.actigence', name: 'resttemplate-request-logger', version: '0.0.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; }}
- Now whenever you access any URL using this RestTemplate bean.The request will be seamlessly intercepted by the
OutboundRequestTrackingInterceptor
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);
- Seeresttemplate-request-logger-demo for full example code.
About
Log requests being made using RestTemplate clients to AWS DynamoDb
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published