From 91dda272068cbf48c713885e0cdee0ced736cc50 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Thu, 30 May 2024 11:39:12 -0400 Subject: [PATCH] use ArchiveRecordingEvent instead of Active --- .../cryostat/recordings/RecordingHelper.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/cryostat/recordings/RecordingHelper.java b/src/main/java/io/cryostat/recordings/RecordingHelper.java index 2da0b3c10..04dc82cbd 100644 --- a/src/main/java/io/cryostat/recordings/RecordingHelper.java +++ b/src/main/java/io/cryostat/recordings/RecordingHelper.java @@ -18,6 +18,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; +import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLDecoder; @@ -875,10 +876,22 @@ public ArchivedRecording archiveRecording( throw e; } if (expiry == null) { + ArchivedRecording archivedRecording = + new ArchivedRecording( + recording.target.jvmId, + filename, + downloadUrl(recording.target.jvmId, filename), + reportUrl(recording.target.jvmId, filename), + recording.metadata, + accum, + now.getEpochSecond()); + + URI connectUrl = recording.target.connectUrl; + var event = - new ActiveRecordingEvent( - Recordings.RecordingEventCategory.ACTIVE_SAVED, - ActiveRecordingEvent.Payload.of(this, recording)); + new ArchivedRecordingEvent( + Recordings.RecordingEventCategory.ARCHIVED_CREATED, + ArchivedRecordingEvent.Payload.of(connectUrl, archivedRecording)); bus.publish(event.category().category(), event.payload().recording()); bus.publish( MessagingServer.class.getName(),