@@ -684,6 +684,10 @@ CompletableFuture<BaseResponse> getResponseAsync(BaseMessage message, WebSocket
684684 case FORK_WORKFLOW -> handleFork (this , message );
685685 case GET_METRICS -> handleGetMetrics (this , message );
686686 case GET_SCHEDULE -> handleGetSchedule (this , message );
687+ case GET_WORKFLOW_AGGREGATES -> handleGetWorkflowAggregates (this , message );
688+ case GET_WORKFLOW_EVENTS -> handleGetWorkflowEvents (this , message );
689+ case GET_WORKFLOW_NOTIFICATIONS -> handleGetWorkflowNotifications (this , message );
690+ case GET_WORKFLOW_STREAMS -> handleGetWorkflowStreams (this , message );
687691 case GET_WORKFLOW -> handleGetWorkflow (this , message );
688692 case IMPORT_WORKFLOW -> handleImportWorkflow (this , message );
689693 case LIST_APPLICATION_VERSIONS -> handleListApplicationVersions (this , message );
@@ -988,6 +992,75 @@ static CompletableFuture<BaseResponse> handleGetMetrics(
988992 });
989993 }
990994
995+ static CompletableFuture <BaseResponse > handleGetWorkflowAggregates (
996+ Conductor conductor , BaseMessage message ) {
997+ return CompletableFuture .supplyAsync (
998+ () -> {
999+ GetWorkflowAggregatesRequest request = (GetWorkflowAggregatesRequest ) message ;
1000+ try {
1001+ var rows = conductor .systemDatabase .getWorkflowAggregates (request .toInput ());
1002+ return new GetWorkflowAggregatesResponse (request , rows );
1003+ } catch (Exception e ) {
1004+ logger .error ("Exception encountered when getting workflow aggregates" , e );
1005+ return new GetWorkflowAggregatesResponse (request , e );
1006+ }
1007+ });
1008+ }
1009+
1010+ static CompletableFuture <BaseResponse > handleGetWorkflowEvents (
1011+ Conductor conductor , BaseMessage message ) {
1012+ return CompletableFuture .supplyAsync (
1013+ () -> {
1014+ GetWorkflowEventsRequest request = (GetWorkflowEventsRequest ) message ;
1015+ try {
1016+ var events = conductor .systemDatabase .getAllEvents (request .workflow_id );
1017+ return new GetWorkflowEventsResponse (request , events );
1018+ } catch (Exception e ) {
1019+ logger .error (
1020+ "Exception encountered when getting workflow events for {}" ,
1021+ request .workflow_id ,
1022+ e );
1023+ return new GetWorkflowEventsResponse (request , e );
1024+ }
1025+ });
1026+ }
1027+
1028+ static CompletableFuture <BaseResponse > handleGetWorkflowNotifications (
1029+ Conductor conductor , BaseMessage message ) {
1030+ return CompletableFuture .supplyAsync (
1031+ () -> {
1032+ GetWorkflowNotificationsRequest request = (GetWorkflowNotificationsRequest ) message ;
1033+ try {
1034+ var notifications = conductor .systemDatabase .getAllNotifications (request .workflow_id );
1035+ return new GetWorkflowNotificationsResponse (request , notifications );
1036+ } catch (Exception e ) {
1037+ logger .error (
1038+ "Exception encountered when getting workflow notifications for {}" ,
1039+ request .workflow_id ,
1040+ e );
1041+ return new GetWorkflowNotificationsResponse (request , e );
1042+ }
1043+ });
1044+ }
1045+
1046+ static CompletableFuture <BaseResponse > handleGetWorkflowStreams (
1047+ Conductor conductor , BaseMessage message ) {
1048+ return CompletableFuture .supplyAsync (
1049+ () -> {
1050+ GetWorkflowStreamsRequest request = (GetWorkflowStreamsRequest ) message ;
1051+ try {
1052+ var streams = conductor .systemDatabase .getAllStreamEntries (request .workflow_id );
1053+ return new GetWorkflowStreamsResponse (request , streams );
1054+ } catch (Exception e ) {
1055+ logger .error (
1056+ "Exception encountered when getting workflow streams for {}" ,
1057+ request .workflow_id ,
1058+ e );
1059+ return new GetWorkflowStreamsResponse (request , e );
1060+ }
1061+ });
1062+ }
1063+
9911064 private static boolean isImportMessage (CharSequence data ) {
9921065 int checkLen = Math .min (data .length (), 200 );
9931066 return data .subSequence (0 , checkLen ).toString ().contains ("\" import_workflow\" " );
0 commit comments