# 이 데코레이터가 자기에게 매긴 계약 FailOpenNotificationProvider.java:7 /** FailOpenNotificationProvider.java:8 * Fail-open decorator: a provider failure is logged (no payload/PII) and swallowed so a FailOpenNotificationProvider.java:9 * notification — a side-effect — never fails the core use case. Applied centrally by FailOpenNotificationProvider.java:10 * NotificationConfig. FailOpenNotificationProvider.java:11 */ # 실패 경로 : catch 안에서 실패 로그를 부른다 FailOpenNotificationProvider.java:35 @Override FailOpenNotificationProvider.java:36 public void send(Notification notification) { FailOpenNotificationProvider.java:37 try { FailOpenNotificationProvider.java:38 delegate.send(notification); FailOpenNotificationProvider.java:39 dependencyLogger.logSuccess(delegate.providerId(), DEPENDENCY_TYPE, "send"); FailOpenNotificationProvider.java:40 } catch (Exception ex) { FailOpenNotificationProvider.java:41 // fail-open: observe (no payload/PII), do not fail the core use case. FailOpenNotificationProvider.java:42 dependencyLogger.logFailure(delegate.providerId(), DEPENDENCY_TYPE, "send", ex); FailOpenNotificationProvider.java:43 } FailOpenNotificationProvider.java:44 } FailOpenNotificationProvider.java:45 } # 메시징 쪽의 같은 자리 : catch 안도 observeQuietly 를 거친다 OutboundMessagePublisher.java:26 @Override OutboundMessagePublisher.java:27 public void publish(OutboundMessage message) { OutboundMessagePublisher.java:28 // The send and the observation are separate steps because they used to share a try block: a OutboundMessagePublisher.java:29 // logger that threw after a successful send was caught by the same catch and reported as a OutboundMessagePublisher.java:30 // publish failure. The broker had accepted the message; the only thing that failed was the OutboundMessagePublisher.java:31 // record of it, and the two must not be confusable. OutboundMessagePublisher.java:32 boolean sent = false; OutboundMessagePublisher.java:33 try { OutboundMessagePublisher.java:34 broker.send(message); OutboundMessagePublisher.java:35 sent = true; OutboundMessagePublisher.java:36 } catch (Exception ex) { OutboundMessagePublisher.java:37 // fail-open: observe with correlationId, delegate durability to outbox/retry, OutboundMessagePublisher.java:38 // do NOT propagate — the core use case must still succeed. OutboundMessagePublisher.java:39 observeQuietly( OutboundMessagePublisher.java:40 () -> dependencyLogger.logFailure(broker.brokerId(), DEPENDENCY_TYPE, "publish", ex)); OutboundMessagePublisher.java:41 } OutboundMessagePublisher.java:42 if (sent) { OutboundMessagePublisher.java:43 observeQuietly( OutboundMessagePublisher.java:44 () -> dependencyLogger.logSuccess(broker.brokerId(), DEPENDENCY_TYPE, "publish")); OutboundMessagePublisher.java:45 } OutboundMessagePublisher.java:46 } OutboundMessagePublisher.java:48 /** OutboundMessagePublisher.java:49 * Runs an observation, absorbing whatever it throws. OutboundMessagePublisher.java:50 * OutboundMessagePublisher.java:51 *
Diagnostics are non-authoritative. An appender that is out of disk must not change what the
OutboundMessagePublisher.java:52 * caller believes about the broker.
OutboundMessagePublisher.java:53 */
OutboundMessagePublisher.java:54 private static void observeQuietly(Runnable observation) {
OutboundMessagePublisher.java:55 try {
OutboundMessagePublisher.java:56 observation.run();
OutboundMessagePublisher.java:57 } catch (RuntimeException ignored) {
OutboundMessagePublisher.java:58 // Nothing to report it to: the reporter is what failed.
OutboundMessagePublisher.java:59 }
OutboundMessagePublisher.java:60 }
# 그 데코레이터를 부르는 팬아웃 루프
RoutingNotifier.java:112 @Override
RoutingNotifier.java:113 public void notify(Channel channel, String route, Notification notification) {
RoutingNotifier.java:114 List