@@ -43,12 +43,13 @@
|
||||
mtype: 'POST',
|
||||
url: url,
|
||||
postData: getSearchForJqgrid("cmd", "LIST"),
|
||||
colNames: ['id', 'No', '기관명', 'Target URL', '신청일시'],
|
||||
colNames: ['id', 'No', '기관명', 'Target URL', 'Send URL', '신청일시'],
|
||||
colModel: [
|
||||
{name: 'id', align: 'center', key: true, hidden: true},
|
||||
{name: 'rowNum', align: 'center', width: 45, sortable: false},
|
||||
{name: 'orgName', align: 'left', width: 160},
|
||||
{name: 'targetUrl', align: 'left', width: 380, formatter: formatTargetUrl},
|
||||
{name: 'targetUrl', align: 'left', width: 300, formatter: formatTargetUrl},
|
||||
{name: 'sendUrl', align: 'left', width: 300, formatter: formatTargetUrl},
|
||||
{name: 'createdDate', align: 'center', width: 140}
|
||||
],
|
||||
jsonReader: {repeatitems: false},
|
||||
@@ -125,6 +126,7 @@
|
||||
<colgroup>
|
||||
<col style="width:120px;"><col style="width:200px;">
|
||||
<col style="width:120px;"><col style="width:200px;">
|
||||
<col style="width:120px;"><col style="width:200px;">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
@@ -132,6 +134,8 @@
|
||||
<td><input type="text" name="searchOrgName" autocomplete="off"></td>
|
||||
<th>Target URL</th>
|
||||
<td><input type="text" name="searchTargetUrl" autocomplete="off" style="width:95%;"></td>
|
||||
<th>Send URL</th>
|
||||
<td><input type="text" name="searchSendUrl" autocomplete="off" style="width:95%;"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -96,6 +96,12 @@
|
||||
$('#targetUrl').focus();
|
||||
return;
|
||||
}
|
||||
var sendUrl = $.trim($('#sendUrl').val());
|
||||
if (sendUrl && !/^https?:\/\/.+/i.test(sendUrl)) {
|
||||
alert('Send URL은 http:// 또는 https:// 로 시작하는 전체 주소를 입력해주세요.');
|
||||
$('#sendUrl').focus();
|
||||
return;
|
||||
}
|
||||
if ($('input[name=eventTypes]:checked').length === 0) {
|
||||
alert('신청 이벤트를 1개 이상 선택해주세요.');
|
||||
return;
|
||||
@@ -125,6 +131,7 @@
|
||||
$('#id').text(data.id != null ? data.id : '');
|
||||
$('#orgName').text(data.orgName || '');
|
||||
$('#targetUrl').val(data.targetUrl || '');
|
||||
$('#sendUrl').val(data.sendUrl || '');
|
||||
$('#secret').text(data.secret || '');
|
||||
$('#userSecret').val(data.userSecret || '');
|
||||
$('#createdDate').text(data.createdDate || '');
|
||||
@@ -141,7 +148,7 @@
|
||||
|
||||
buttonControl('DETAIL');
|
||||
if (!canWrite) {
|
||||
$('#targetUrl, #userSecret').prop('readonly', true);
|
||||
$('#targetUrl, #sendUrl, #userSecret').prop('readonly', true);
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
@@ -190,6 +197,10 @@
|
||||
<th>Target URL <font color="red">*</font></th>
|
||||
<td colspan="3"><input type="text" id="targetUrl" name="targetUrl" maxlength="255" style="width:100%"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Send URL</th>
|
||||
<td colspan="3"><input type="text" id="sendUrl" name="sendUrl" maxlength="255" style="width:100%"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Secret</th>
|
||||
<td colspan="3"><span id="secret"></span></td>
|
||||
|
||||
@@ -89,13 +89,14 @@
|
||||
mtype: 'POST',
|
||||
url: url,
|
||||
postData: getSearchForJqgrid("cmd", "LIST"),
|
||||
colNames: ['id', 'No.', '기관명', '이벤트유형', 'Target URL', 'Status', '성공여부', '재시도', '발송서버', '발송일시'],
|
||||
colNames: ['id', 'No.', '기관명', '이벤트유형', 'Target URL', 'Send URL', 'Status', '성공여부', '재시도', '발송서버', '발송일시'],
|
||||
colModel: [
|
||||
{name: 'id', align: 'center', key: true, hidden: true},
|
||||
{name: 'rowNum', align: 'center', width: 45, sortable: false},
|
||||
{name: 'orgName', align: 'left', width: 140},
|
||||
{name: 'eventType', align: 'center', width: 120, formatter: formatEventType},
|
||||
{name: 'targetUrl', align: 'left', width: 300, formatter: formatTargetUrl},
|
||||
{name: 'targetUrl', align: 'left', width: 250, formatter: formatTargetUrl},
|
||||
{name: 'sendUrl', align: 'left', width: 250, formatter: formatTargetUrl},
|
||||
{name: 'statusCode', align: 'center', width: 60},
|
||||
{name: 'success', align: 'center', width: 70, formatter: formatSuccess},
|
||||
{name: 'retryCount', align: 'center', width: 60},
|
||||
@@ -198,6 +199,14 @@
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>발송기간</th>
|
||||
<td>
|
||||
<input type="text" name="searchStartYYYYMMDD" id="startDatepicker" readonly="readonly" value="" size="10" style="width:100px; border:1px solid #ebebec;">
|
||||
~
|
||||
<input type="text" name="searchEndYYYYMMDD" value="" id="endDatepicker" size="10" readonly="readonly" style="width:100px; border:1px solid #ebebec;">
|
||||
<input type="hidden" name="searchStartDate" value="">
|
||||
<input type="hidden" name="searchEndDate" value="">
|
||||
</td>
|
||||
<th>기관명</th>
|
||||
<td><input type="text" name="searchOrgName" autocomplete="off"></td>
|
||||
<th>이벤트유형</th>
|
||||
@@ -206,7 +215,14 @@
|
||||
<select name="searchEventType"></select>
|
||||
</div>
|
||||
</td>
|
||||
<th>성공여부</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Target URL</th>
|
||||
<td><input type="text" name="searchTargetUrl" autocomplete="off" style="width:95%;"></td>
|
||||
|
||||
<th>Send URL</th>
|
||||
<td><input type="text" name="searchSendUrl" autocomplete="off" style="width:95%;"></td>
|
||||
<th>성공여부</th>
|
||||
<td>
|
||||
<div class="select-style">
|
||||
<select name="searchSuccess">
|
||||
@@ -217,20 +233,6 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Target URL</th>
|
||||
<td><input type="text" name="searchTargetUrl" autocomplete="off" style="width:95%;"></td>
|
||||
<th>발송기간</th>
|
||||
<td>
|
||||
<input type="text" name="searchStartYYYYMMDD" id="startDatepicker" readonly="readonly" value="" size="10" style="width:100px; border:1px solid #ebebec;">
|
||||
~
|
||||
<input type="text" name="searchEndYYYYMMDD" value="" id="endDatepicker" size="10" readonly="readonly" style="width:100px; border:1px solid #ebebec;">
|
||||
<input type="hidden" name="searchStartDate" value="">
|
||||
<input type="hidden" name="searchEndDate" value="">
|
||||
</td>
|
||||
<th></th>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
$('#eventType').text(data.eventTypeName || data.eventType || '')
|
||||
.attr('title', data.eventType || '');
|
||||
$('#targetUrl').text(data.targetUrl || '');
|
||||
$('#sendUrl').text(data.sendUrl || '');
|
||||
$('#statusCode').text(data.statusCode != null ? data.statusCode : '');
|
||||
$('#retryCount').text(data.retryCount != null ? data.retryCount : '');
|
||||
$('#sendBy').text(data.sendBy || '');
|
||||
@@ -100,6 +101,10 @@
|
||||
<th>Target URL</th>
|
||||
<td colspan="3"><span id="targetUrl"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Send URL</th>
|
||||
<td colspan="3"><span id="sendUrl"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>성공여부</th>
|
||||
<td><span id="success"></span></td>
|
||||
|
||||
@@ -188,7 +188,7 @@ class RequestWrapper extends HttpServletRequestWrapper {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// 웹훅 Target URL(쿼리스트링 '&', '#')과 User Secret(HTTP 헤더로 발송)은 원문 그대로 저장되어야 함.
|
||||
// 웹훅 Target URL/Send URL(쿼리스트링 '&', '#')과 User Secret(HTTP 헤더로 발송)은 원문 그대로 저장되어야 함.
|
||||
if ("POST".equalsIgnoreCase(getMethod())
|
||||
&& "/onl/apim/webhook/webhookReqMan.json".equals(getServletPath())
|
||||
&& "UPDATE".equals(super.getParameter("cmd"))) {
|
||||
|
||||
@@ -27,6 +27,10 @@ public class WebhookReq {
|
||||
@Comment("웹훅 수신 URL")
|
||||
private String targetUrl;
|
||||
|
||||
@Column(name = "SEND_URL", length = 500)
|
||||
@Comment("웹훅 발송 URL")
|
||||
private String sendUrl;
|
||||
|
||||
@Column(name = "SECRET", length = 200)
|
||||
@Comment("HMAC 서명용 Secret Key")
|
||||
private String secret;
|
||||
@@ -39,9 +43,10 @@ public class WebhookReq {
|
||||
@Comment("신청일시 (yyyyMMddHHmmss)")
|
||||
private String createdDate;
|
||||
|
||||
/** 관리자 화면 수정 — Target URL / User Secret. (SECRET 은 HMAC 서명 키라 수정 대상 아님) */
|
||||
public void update(String targetUrl, String userSecret) {
|
||||
/** 관리자 화면 수정 — Target URL / Send URL / User Secret. (SECRET 은 HMAC 서명 키라 수정 대상 아님) */
|
||||
public void update(String targetUrl, String sendUrl, String userSecret) {
|
||||
this.targetUrl = targetUrl;
|
||||
this.sendUrl = sendUrl;
|
||||
this.userSecret = userSecret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@ public class WebhookSendLog {
|
||||
@Column(name = "TARGET_URL", length = 500)
|
||||
private String targetUrl;
|
||||
|
||||
/** 실제 발송 주소 (PTL_WEBHOOK_REQ.SEND_URL) */
|
||||
@Column(name = "SEND_URL", length = 500)
|
||||
private String sendUrl;
|
||||
|
||||
@Column(name = "EVENT_TYPE", length = 100)
|
||||
private String eventType;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ public class WebhookReqDetailUI {
|
||||
private String reverseProxyPath;
|
||||
|
||||
private String targetUrl;
|
||||
private String sendUrl;
|
||||
private String secret;
|
||||
private String userSecret;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ public class WebhookReqUI {
|
||||
private String reverseProxyPath;
|
||||
|
||||
private String targetUrl;
|
||||
private String sendUrl;
|
||||
|
||||
/* 신청일시 — yyyy-MM-dd HH:mm:ss */
|
||||
private String createdDate;
|
||||
|
||||
@@ -13,4 +13,7 @@ public class WebhookReqUISearch {
|
||||
|
||||
/* 수신 URL (LIKE 검색) */
|
||||
private String searchTargetUrl;
|
||||
|
||||
/* 발송 URL (LIKE 검색) */
|
||||
private String searchSendUrl;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.Data;
|
||||
/**
|
||||
* 웹훅 신청내역(PTL_WEBHOOK_REQ) 상세 화면 수정 요청 DTO.
|
||||
*
|
||||
* <p>Target URL, User Secret, 신청 이벤트(PTL_WEBHOOK_REQ_EVENT)만 수정한다.</p>
|
||||
* <p>Target URL, Send URL, User Secret, 신청 이벤트(PTL_WEBHOOK_REQ_EVENT)만 수정한다.</p>
|
||||
*/
|
||||
@Data
|
||||
public class WebhookReqUpdateUI {
|
||||
@@ -16,6 +16,9 @@ public class WebhookReqUpdateUI {
|
||||
|
||||
private String targetUrl;
|
||||
|
||||
/** 공란이면 Send URL 을 비운다(null). */
|
||||
private String sendUrl;
|
||||
|
||||
/** 공란이면 User Secret 을 비운다(null). */
|
||||
private String userSecret;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ public class WebhookSendLogUI {
|
||||
/** 모니터링 공통코드(EVENT_TYPE) 코드명. 상세 조회에서만 채워진다(목록은 화면에서 콤보로 변환). */
|
||||
private String eventTypeName;
|
||||
private String targetUrl;
|
||||
private String sendUrl;
|
||||
|
||||
private String payload;
|
||||
private String signature;
|
||||
|
||||
@@ -14,6 +14,9 @@ public class WebhookSendLogUISearch {
|
||||
/* 수신 URL (LIKE 검색) */
|
||||
private String searchTargetUrl;
|
||||
|
||||
/* 발송 URL (LIKE 검색) */
|
||||
private String searchSendUrl;
|
||||
|
||||
/* 성공여부 (Y/N, 공백=전체) */
|
||||
private String searchSuccess;
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import lombok.Setter;
|
||||
public class WebhookSendRequest {
|
||||
private String orgId;
|
||||
private String targetUrl;
|
||||
/** 실제 발송 주소 (PTL_WEBHOOK_REQ.SEND_URL) */
|
||||
private String sendUrl;
|
||||
private String eventType;
|
||||
private String secret;
|
||||
private String userSecret;
|
||||
|
||||
+21
-5
@@ -64,8 +64,9 @@ public class WebhookReqManService extends BaseService {
|
||||
private static final Set<String> HIDDEN_EVENT_TYPES = Collections.unmodifiableSet(
|
||||
new HashSet<>(Arrays.asList("CHECK_NOTICE")));
|
||||
|
||||
/* DB 컬럼 길이 (PTL_WEBHOOK_REQ.TARGET_URL / USER_SECRET) */
|
||||
private static final int TARGET_URL_MAX_LENGTH = 255;
|
||||
/* DB 컬럼 길이 (PTL_WEBHOOK_REQ.TARGET_URL / SEND_URL / USER_SECRET) */
|
||||
private static final int TARGET_URL_MAX_LENGTH = 500;
|
||||
private static final int SEND_URL_MAX_LENGTH = 500;
|
||||
private static final int USER_SECRET_MAX_LENGTH = 500;
|
||||
|
||||
private static final DateTimeFormatter FMT_DATETIME_OUT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -99,6 +100,9 @@ public class WebhookReqManService extends BaseService {
|
||||
if (StringUtils.isNotBlank(search.getSearchTargetUrl())) {
|
||||
predicate.and(req.targetUrl.containsIgnoreCase(search.getSearchTargetUrl()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(search.getSearchSendUrl())) {
|
||||
predicate.and(req.sendUrl.containsIgnoreCase(search.getSearchSendUrl()));
|
||||
}
|
||||
|
||||
Page<WebhookReq> page = webhookReqRepository.findAll(predicate, pageable);
|
||||
|
||||
@@ -119,6 +123,7 @@ public class WebhookReqManService extends BaseService {
|
||||
ui.setOrgName(orgInfo != null ? orgInfo.orgName : null);
|
||||
ui.setReverseProxyPath(orgInfo != null ? orgInfo.reverseProxyPath : null);
|
||||
ui.setTargetUrl(entity.getTargetUrl());
|
||||
ui.setSendUrl(entity.getSendUrl());
|
||||
ui.setSecret(entity.getSecret());
|
||||
ui.setUserSecret(entity.getUserSecret());
|
||||
ui.setCreatedDate(fmtCreatedDate(entity.getCreatedDate()));
|
||||
@@ -135,10 +140,10 @@ public class WebhookReqManService extends BaseService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Target URL / User Secret / 신청 이벤트 수정.
|
||||
* Target URL / Send URL / User Secret / 신청 이벤트 수정.
|
||||
*
|
||||
* <p>SECRET(HMAC 서명 키)과 API 목록은 수정하지 않는다. 이벤트는 delete-all 후 재등록한다.
|
||||
* User Secret 은 상세 화면에 평문으로 표시되므로 공란 제출 시 값을 비운다(null).</p>
|
||||
* Send URL, User Secret 은 공란 제출 시 값을 비운다(null).</p>
|
||||
*/
|
||||
public void update(WebhookReqUpdateUI ui) {
|
||||
WebhookReq entity = webhookReqRepository.findById(ui.getId())
|
||||
@@ -152,6 +157,16 @@ public class WebhookReqManService extends BaseService {
|
||||
throw new BizException("Target URL은 " + TARGET_URL_MAX_LENGTH + "자를 초과할 수 없습니다.");
|
||||
}
|
||||
|
||||
String sendUrl = StringUtils.trimToNull(ui.getSendUrl());
|
||||
if (sendUrl != null) {
|
||||
if (!isValidUrl(sendUrl)) {
|
||||
throw new BizException("Send URL이 올바른 URL 형식이 아닙니다. http:// 또는 https:// 로 시작하는 전체 주소를 입력해주세요.");
|
||||
}
|
||||
if (sendUrl.length() > SEND_URL_MAX_LENGTH) {
|
||||
throw new BizException("Send URL은 " + SEND_URL_MAX_LENGTH + "자를 초과할 수 없습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
String userSecret = StringUtils.trimToNull(ui.getUserSecret());
|
||||
if (userSecret != null) {
|
||||
if (userSecret.length() > USER_SECRET_MAX_LENGTH) {
|
||||
@@ -177,7 +192,7 @@ public class WebhookReqManService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
entity.update(targetUrl, userSecret);
|
||||
entity.update(targetUrl, sendUrl, userSecret);
|
||||
webhookReqRepository.save(entity);
|
||||
|
||||
QWebhookReqEvent evt = QWebhookReqEvent.webhookReqEvent;
|
||||
@@ -273,6 +288,7 @@ public class WebhookReqManService extends BaseService {
|
||||
ui.setOrgName(orgInfo != null ? orgInfo.orgName : null);
|
||||
ui.setReverseProxyPath(orgInfo != null ? orgInfo.reverseProxyPath : null);
|
||||
ui.setTargetUrl(e.getTargetUrl());
|
||||
ui.setSendUrl(e.getSendUrl());
|
||||
ui.setCreatedDate(fmtCreatedDate(e.getCreatedDate()));
|
||||
return ui;
|
||||
}
|
||||
|
||||
+4
@@ -76,6 +76,9 @@ public class WebhookSendLogManService extends BaseService {
|
||||
if (StringUtils.isNotBlank(search.getSearchTargetUrl())) {
|
||||
predicate.and(log.targetUrl.containsIgnoreCase(search.getSearchTargetUrl()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(search.getSearchSendUrl())) {
|
||||
predicate.and(log.sendUrl.containsIgnoreCase(search.getSearchSendUrl()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(search.getSearchSuccess())) {
|
||||
predicate.and(log.success.eq(search.getSearchSuccess()));
|
||||
}
|
||||
@@ -154,6 +157,7 @@ public class WebhookSendLogManService extends BaseService {
|
||||
ui.setEventType(e.getEventType());
|
||||
ui.setEventTypeName(eventTypeName);
|
||||
ui.setTargetUrl(e.getTargetUrl());
|
||||
ui.setSendUrl(e.getSendUrl());
|
||||
ui.setPayload(e.getPayload());
|
||||
ui.setSignature(e.getSignature());
|
||||
ui.setUserSecret(e.getUserSecret());
|
||||
|
||||
@@ -62,7 +62,7 @@ public class WebhookService {
|
||||
QWebhookReqApi api = QWebhookReqApi.webhookReqApi;
|
||||
|
||||
List<Tuple> tuples = new JPAQueryFactory(entityManager)
|
||||
.select(req.orgId, req.targetUrl, req.secret, req.userSecret, api.id.apiId)
|
||||
.select(req.orgId, req.targetUrl, req.sendUrl, req.secret, req.userSecret, api.id.apiId)
|
||||
.from(req)
|
||||
.join(evt).on(req.id.eq(evt.id.webhookReqId))
|
||||
.join(api).on(req.id.eq(api.id.webhookReqId))
|
||||
@@ -70,14 +70,22 @@ public class WebhookService {
|
||||
.and(api.id.apiId.in(apiIds)))
|
||||
.fetch();
|
||||
|
||||
// orgId + targetUrl + secret 기준으로 그룹핑, apiIds를 data(List)로 집계
|
||||
// orgId + sendUrl 기준으로 그룹핑, apiIds를 data(List)로 집계
|
||||
// 발송 주소는 SEND_URL 을 사용한다 (TARGET_URL 은 고객 신청 원본). SEND_URL 이 없으면 발송 대상에서 제외.
|
||||
Map<String, WebhookSendRequest> resultMap = new LinkedHashMap<>();
|
||||
for (Tuple t : tuples) {
|
||||
String key = t.get(req.orgId) + "|" + t.get(req.targetUrl);
|
||||
String sendUrl = t.get(req.sendUrl);
|
||||
if (sendUrl == null || sendUrl.trim().isEmpty()) {
|
||||
log.info("[Webhook] SEND_URL 미설정으로 발송 스킵 - orgId: {}, event: {}, apiId: {}",
|
||||
t.get(req.orgId), event, t.get(api.id.apiId));
|
||||
continue;
|
||||
}
|
||||
String key = t.get(req.orgId) + "|" + sendUrl;
|
||||
resultMap.computeIfAbsent(key, k -> {
|
||||
WebhookSendRequest wr = new WebhookSendRequest();
|
||||
wr.setOrgId(t.get(req.orgId));
|
||||
wr.setTargetUrl(t.get(req.targetUrl));
|
||||
wr.setSendUrl(sendUrl.trim());
|
||||
wr.setSecret(t.get(req.secret));
|
||||
wr.setUserSecret(t.get(req.userSecret));
|
||||
wr.setEventType(event);
|
||||
@@ -110,6 +118,7 @@ public class WebhookService {
|
||||
public WebhookSendLog send(WebhookSendRequest req) {
|
||||
|
||||
String targetUrl = req.getTargetUrl();
|
||||
String sendUrl = req.getSendUrl();
|
||||
String secret = req.getSecret();
|
||||
String userSecret = req.getUserSecret();
|
||||
String eventType = req.getEventType();
|
||||
@@ -120,6 +129,7 @@ public class WebhookService {
|
||||
WebhookSendLog sendLog = new WebhookSendLog();
|
||||
sendLog.setOrgId(req.getOrgId());
|
||||
sendLog.setTargetUrl(targetUrl);
|
||||
sendLog.setSendUrl(sendUrl);
|
||||
sendLog.setEventType(eventType);
|
||||
sendLog.setUserSecret(userSecret);
|
||||
sendLog.setSendBy(ContainerUtil.getInstanceName());
|
||||
@@ -147,7 +157,7 @@ public class WebhookService {
|
||||
int retryTime = monitoringContext.getIntProperty(MonitoringContext.RMS_WEBHOOK_RETRY_TIME, DEFAULT_RETRY_TIME);
|
||||
sendLog.setSentAt(LocalDateTime.now());
|
||||
HttpEntity<String> httpRequest = new HttpEntity<>(payloadJson, headers);
|
||||
ResponseEntity<String> response = sendWithRetry(targetUrl, httpRequest, sendLog, retryCount, retryTime);
|
||||
ResponseEntity<String> response = sendWithRetry(sendUrl, httpRequest, sendLog, retryCount, retryTime);
|
||||
|
||||
// 5. 성공 로그
|
||||
sendLog.setStatusCode(response.getStatusCode().value());
|
||||
@@ -155,7 +165,7 @@ public class WebhookService {
|
||||
sendLog.setSuccess(response.getStatusCode().is2xxSuccessful());
|
||||
|
||||
log.info("[Webhook] 발송 성공 - eventType: {}, url: {}, status: {}, retryCount: {}",
|
||||
eventType, targetUrl, response.getStatusCode(), sendLog.getRetryCount());
|
||||
eventType, sendUrl, response.getStatusCode(), sendLog.getRetryCount());
|
||||
|
||||
} catch (HttpClientErrorException | HttpServerErrorException e) {
|
||||
sendLog.setStatusCode(e.getStatusCode().value());
|
||||
@@ -163,13 +173,13 @@ public class WebhookService {
|
||||
sendLog.setSuccess(false);
|
||||
sendLog.setErrorMessage(e.getMessage());
|
||||
log.error("[Webhook] HTTP 오류 - eventType: {}, url: {}, status: {}",
|
||||
eventType, targetUrl, e.getStatusCode());
|
||||
eventType, sendUrl, e.getStatusCode());
|
||||
|
||||
} catch (Exception e) {
|
||||
sendLog.setSuccess(false);
|
||||
sendLog.setErrorMessage(e.getMessage());
|
||||
log.error("[Webhook] 발송 실패 - eventType: {}, url: {}, error: {}",
|
||||
eventType, targetUrl, e.getMessage());
|
||||
eventType, sendUrl, e.getMessage());
|
||||
}
|
||||
|
||||
return sendLogRepository.save(sendLog);
|
||||
|
||||
Reference in New Issue
Block a user