parent
b33422aa21
commit
4d513639ac
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in new issue