com.actigence:resttemplate-request-logger

Log all the outgoing API calls made through Spring's RestTemplate to API Access Tracker backend (https://github.com/Actigence/api-access-tracker-backend)

Лицензия

Лицензия

Группа

Группа

com.actigence
Идентификатор

Идентификатор

resttemplate-request-logger
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

com.actigence:resttemplate-request-logger
Log all the outgoing API calls made through Spring's RestTemplate to API Access Tracker backend (https://github.com/Actigence/api-access-tracker-backend)
Ссылка на сайт

Ссылка на сайт

https://github.com/actigence/resttemplate-request-logger
Система контроля версий

Система контроля версий

https://github.com/actigence/resttemplate-request-logger

Скачать resttemplate-request-logger

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.actigence/resttemplate-request-logger/ -->
<dependency>
    <groupId>com.actigence</groupId>
    <artifactId>resttemplate-request-logger</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.actigence/resttemplate-request-logger/
implementation 'com.actigence:resttemplate-request-logger:1.0.0'
// https://jarcasting.com/artifacts/com.actigence/resttemplate-request-logger/
implementation ("com.actigence:resttemplate-request-logger:1.0.0")
'com.actigence:resttemplate-request-logger:jar:1.0.0'
<dependency org="com.actigence" name="resttemplate-request-logger" rev="1.0.0">
  <artifact name="resttemplate-request-logger" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.actigence', module='resttemplate-request-logger', version='1.0.0')
)
libraryDependencies += "com.actigence" % "resttemplate-request-logger" % "1.0.0"
[com.actigence/resttemplate-request-logger "1.0.0"]

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
org.projectlombok : lombok jar 1.18.12
org.apache.logging.log4j : log4j-api jar 2.13.2
org.apache.logging.log4j : log4j-core jar 2.13.2
org.apache.logging.log4j : log4j-slf4j-impl jar 2.13.2
com.google.code.gson : gson jar 2.8.6
com.amazonaws : aws-java-sdk-sqs jar

provided (3)

Идентификатор библиотеки Тип Версия
org.springframework : spring-web jar 5.2.6.RELEASE
org.springframework : spring-context jar 5.2.6.RELEASE
javax.servlet : javax.servlet-api jar 4.0.1

Модули Проекта

Данный проект не имеет модулей.

RestTemplate Request Logger

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 using API Access Tracker (Backend). Please visit API Access Tracker (Backend) to setup AWS 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 in API 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 your build.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.
@Configuration
public class RestTemplateConfig {

    @Bean
    public RestTemplate restTemplate() {
        ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory());
        RestTemplate restTemplate = new RestTemplate(factory);
        restTemplate.setInterceptors(singletonList(new OutboundRequestTrackingInterceptor()));
        return restTemplate;
    }
}
  1. Now whenever you access any URL using this RestTemplate bean. The request will be seamlessly intercepted by the OutboundRequestTrackingInterceptor class and an event will be published to the AWS SQS for storing that request and response.
Quote quote = restTemplate.getForObject(
        "https://gturnquist-quoters.cfapps.io/api/random", Quote.class);
  1. See resttemplate-request-logger-demo for full example code.
com.actigence

Actigence Solutions

Версии библиотеки

Версия
1.0.0