종료명령어 작업중

main
icksishu@gmail.com 3 months ago
parent b33422aa21
commit 4d513639ac

@ -49,6 +49,7 @@ repositories {
dependencies { dependencies {
implementation 'org.springframework.boot:spring-boot-starter-jdbc' implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.4' implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.4'
compileOnly 'org.projectlombok:lombok' compileOnly 'org.projectlombok:lombok'
implementation 'com.h2database:h2' implementation 'com.h2database:h2'

@ -0,0 +1,48 @@
package com.bsmlab.dfx.agent.config;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import java.util.Map;
@Endpoint(id = "shutdown")
@Component
@RequiredArgsConstructor
@Slf4j
public class DfxAgentShutdownEndpoint {
private final ApplicationContext applicationContext;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public static class DfxAgentShutdownRequestDto {
private String comment;
private int exitCode;
private int delaySeconds;
private int forceAfterSeconds;
}
/**
* # 3 , 15 (), exitCode=0
* curl -X POST http://localhost:8080/actuator/shutdown \
* -H "Content-Type: application/json" \
* -d '{
* "comment":"배포하기 위해 종료",
* "exitCode":0,
* "delaySeconds":3,
* "forceAfterSeconds":15
* }'
* @param body
* @return
*/
@WriteOperation // Actuator 엔드포인트는 @WriteOperation 으로 POST 요청을 수신함. @ReadOperation GET 요청 수신
public Map<String, Object> shutdown(DfxAgentShutdownRequestDto body) {
return null;
}
}

@ -7,6 +7,14 @@ spring:
multipart: multipart:
max-file-size: 1GB max-file-size: 1GB
max-request-size: 1GB max-request-size: 1GB
management:
endpoints:
web:
exposure:
include: shutdown
endpoint:
shutdown:
enabled: true
logging: logging:
level: level:
root: ERROR root: ERROR

Loading…
Cancel
Save