mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-28 03:40:04 +00:00
Added announcement channel (#6604)
* Added announcement channel * Added announcement channel * Addressing comments
This commit is contained in:
parent
9012bf7f06
commit
555962dfd3
@ -22,6 +22,7 @@ import static org.openmetadata.common.utils.CommonUtil.listOrEmpty;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -182,7 +183,12 @@ public class ChangeEventHandler implements EventHandler {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case Announcement:
|
case Announcement:
|
||||||
default:
|
AnnouncementDetails announcementDetails = thread.getAnnouncement();
|
||||||
|
Long currentTimestamp = Instant.now().getEpochSecond();
|
||||||
|
if (announcementDetails.getStartTime() <= currentTimestamp
|
||||||
|
&& currentTimestamp <= announcementDetails.getEndTime()) {
|
||||||
|
WebSocketManager.getInstance().broadCastMessageToAll(WebSocketManager.ANNOUNCEMENT_CHANNEL, jsonThread);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
|
@ -21,6 +21,7 @@ public class WebSocketManager {
|
|||||||
public static final String FEED_BROADCAST_CHANNEL = "activityFeed";
|
public static final String FEED_BROADCAST_CHANNEL = "activityFeed";
|
||||||
public static final String TASK_BROADCAST_CHANNEL = "taskChannel";
|
public static final String TASK_BROADCAST_CHANNEL = "taskChannel";
|
||||||
public static final String MENTION_CHANNEL = "mentionChannel";
|
public static final String MENTION_CHANNEL = "mentionChannel";
|
||||||
|
public static final String ANNOUNCEMENT_CHANNEL = "announcementChannel";
|
||||||
private final Map<UUID, Map<String, SocketIoSocket>> activityFeedEndpoints = new ConcurrentHashMap<>();
|
private final Map<UUID, Map<String, SocketIoSocket>> activityFeedEndpoints = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private WebSocketManager(EngineIoServerOptions eiOptions) {
|
private WebSocketManager(EngineIoServerOptions eiOptions) {
|
||||||
@ -54,11 +55,15 @@ public class WebSocketManager {
|
|||||||
allUserConnection.remove(socket.getId());
|
allUserConnection.remove(socket.getId());
|
||||||
activityFeedEndpoints.put(id, allUserConnection);
|
activityFeedEndpoints.put(id, allUserConnection);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// On Socket Connection Error
|
||||||
socket.on(
|
socket.on(
|
||||||
"connect_error",
|
"connect_error",
|
||||||
args1 ->
|
args1 ->
|
||||||
LOG.error(
|
LOG.error(
|
||||||
"Connection ERROR for user:{} with Remote Address:{} disconnected", userId, remoteAddress));
|
"Connection ERROR for user:{} with Remote Address:{} disconnected", userId, remoteAddress));
|
||||||
|
|
||||||
|
// On Socket Connection Failure
|
||||||
socket.on(
|
socket.on(
|
||||||
"connect_failed",
|
"connect_failed",
|
||||||
args1 ->
|
args1 ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user