23
23
import com .netflix .priam .backupv2 .IMetaProxy ;
24
24
import com .netflix .priam .backupv2 .SnapshotMetaTask ;
25
25
import com .netflix .priam .config .IConfiguration ;
26
+ import com .netflix .priam .notification .BackupNotificationMgr ;
26
27
import com .netflix .priam .utils .DateUtil ;
27
28
import com .netflix .priam .utils .DateUtil .DateRange ;
28
29
import com .netflix .priam .utils .GsonJsonSerializer ;
@@ -53,6 +54,7 @@ public class BackupServletV2 {
53
54
private final IMetaProxy metaProxy ;
54
55
private final Provider <AbstractBackupPath > pathProvider ;
55
56
private final BackupV2Service backupService ;
57
+ private final BackupNotificationMgr backupNotificationMgr ;
56
58
private static final String REST_SUCCESS = "[\" ok\" ]" ;
57
59
58
60
@ Inject
@@ -65,7 +67,8 @@ public BackupServletV2(
65
67
IBackupFileSystem fileSystem ,
66
68
@ Named ("v2" ) IMetaProxy metaV2Proxy ,
67
69
Provider <AbstractBackupPath > pathProvider ,
68
- BackupV2Service backupService ) {
70
+ BackupV2Service backupService ,
71
+ BackupNotificationMgr backupNotificationMgr ) {
69
72
this .backupStatusMgr = backupStatusMgr ;
70
73
this .backupVerification = backupVerification ;
71
74
this .snapshotMetaService = snapshotMetaService ;
@@ -74,6 +77,7 @@ public BackupServletV2(
74
77
this .metaProxy = metaV2Proxy ;
75
78
this .pathProvider = pathProvider ;
76
79
this .backupService = backupService ;
80
+ this .backupNotificationMgr = backupNotificationMgr ;
77
81
}
78
82
79
83
@ GET
@@ -131,6 +135,17 @@ public Response validateV2SnapshotByDate(
131
135
.build ();
132
136
}
133
137
138
+ // Send notification for any verified backups. This is useful in one-off backup consumption
139
+ // by downward dependencies.
140
+ // Side-effect: It may send notification for already verified snapshot i.e. duplicate
141
+ // message may be sent.
142
+ logger .info (
143
+ "Sending {} message for backup: {}" ,
144
+ AbstractBackupPath .BackupFileType .SNAPSHOT_VERIFIED ,
145
+ result .get ().remotePath );
146
+
147
+ backupNotificationMgr .notify (result .get ().remotePath , result .get ().snapshotInstant );
148
+
134
149
return Response .ok (result .get ().toString ()).build ();
135
150
}
136
151
0 commit comments