From e074bfea2a4cfbaed29bebd44a2bd1d6af645fa4 Mon Sep 17 00:00:00 2001 From: Muhammad Date: Tue, 20 Feb 2024 09:38:51 +0530 Subject: [PATCH 01/12] feat: Add migration scripts to add initial workflows, tasks and event handler --- ...e_execution_workflow_and_event_handler.sql | 109 ++++++++++++++++++ .../V11__siren_webhook_task_and_workflow.sql | 67 +++++++++++ .../V9__siren_send_notification_task.sql | 27 +++++ 3 files changed, 203 insertions(+) create mode 100644 postgres-persistence/src/main/resources/db/migration_postgres/V10__siren_finalize_execution_workflow_and_event_handler.sql create mode 100644 postgres-persistence/src/main/resources/db/migration_postgres/V11__siren_webhook_task_and_workflow.sql create mode 100644 postgres-persistence/src/main/resources/db/migration_postgres/V9__siren_send_notification_task.sql diff --git a/postgres-persistence/src/main/resources/db/migration_postgres/V10__siren_finalize_execution_workflow_and_event_handler.sql b/postgres-persistence/src/main/resources/db/migration_postgres/V10__siren_finalize_execution_workflow_and_event_handler.sql new file mode 100644 index 0000000000..ff9a20f4f5 --- /dev/null +++ b/postgres-persistence/src/main/resources/db/migration_postgres/V10__siren_finalize_execution_workflow_and_event_handler.sql @@ -0,0 +1,109 @@ +-- Enable workflow status listener in all workflow definitions +UPDATE public.meta_workflow_def +SET json_data = jsonb_set( + json_data::jsonb, + '{workflowStatusListenerEnabled}', + 'true'::jsonb +)::text; + +INSERT INTO + public.meta_task_def ("name", json_data) +VALUES +( + 'finalize_workflow_execution_task', + json_build_object( + 'createTime' ,EXTRACT(epoch FROM CURRENT_TIMESTAMP)::bigint * 1000, + 'createdBy' ,'', + 'accessPolicy', jsonb '{}', + 'name' ,'finalize_workflow_execution_task', + 'description' ,'Finalize Workflow Execution Task', + 'retryCount' ,5, + 'timeoutSeconds' ,3600, + 'inputKeys' ,jsonb '[]', + 'outputKeys' ,jsonb '[]', + 'timeoutPolicy' ,'TIME_OUT_WF', + 'retryLogic' ,'EXPONENTIAL_BACKOFF', + 'retryDelaySeconds' ,10, + 'responseTimeoutSeconds' ,600, + 'inputTemplate', jsonb '{}', + 'rateLimitPerFrequency' ,0, + 'rateLimitFrequencyInSeconds' ,1, + 'ownerEmail' ,'admin@sirenapp.io', + 'backoffScaleFactor' ,1 + ) + ); + +INSERT INTO + public.meta_workflow_def ("name", "version", latest_version, json_data) +VALUES( + 'finalize_workflow_execution', + 1, + 1, + json_build_object( + 'createTime',EXTRACT(epoch FROM CURRENT_TIMESTAMP)::bigint * 1000, + 'accessPolicy',jsonb '{}', + 'name','finalize_workflow_execution', + 'description','Workflow for finalizing workflow execution', + 'version',1, + 'tasks', + json_build_array(json_build_object( + 'name','finalize_workflow_execution_task', + 'taskReferenceName','finalize_workflow_execution_task_ref', + 'inputParameters', + json_build_object( + 'status',E'\u0024{workflow.input.status}', + 'externalExecutionId',E'\u0024{workflow.input.workflowId}' + ), + 'type','SIMPLE', + 'startDelay',0, + 'optional',false, + 'asyncComplete',false, + 'permissive',false + )), + 'inputParameters',jsonb '[]', + 'outputParameters',jsonb '{}', + 'schemaVersion',2, + 'restartable',true, + 'workflowStatusListenerEnabled',false, + 'ownerEmail','admin@sirenapp.io', + 'timeoutPolicy','ALERT_ONLY', + 'timeoutSeconds',0, + 'variables',jsonb '{}', + 'inputTemplate',jsonb '{}' + ) + ); + +INSERT INTO + public.meta_event_handler (id, "name", "event", active, json_data) +VALUES( + 1, + 'finalize_workflow_execution_event_handler', + 'conductor:finalize_workflow_execution_event', + true, + json_build_object( + 'name','finalize_workflow_execution_event_handler', + 'event','conductor:finalize_workflow_execution_event', + 'actions', + json_build_array( + json_build_object('action','start_workflow', + 'start_workflow', + json_build_object( + 'name','finalize_workflow_execution', + 'input',json_build_object( + 'workflowType',E'\u0024{workflowType}', + 'version',E'\u0024{version}', + 'workflowId',E'\u0024{workflowId}', + 'correlationId',E'\u0024{correlationId}', + 'status',E'\u0024{status}', + 'input',E'\u0024{input}', + 'output',E'\u0024{output}', + 'reasonForIncompletion',E'\u0024{reasonForIncompletion}', + 'executionTime',E'\u0024{executionTime}', + 'event',E'\u0024{event}') + ) + ) + ), + 'active',true + ) + ); + diff --git a/postgres-persistence/src/main/resources/db/migration_postgres/V11__siren_webhook_task_and_workflow.sql b/postgres-persistence/src/main/resources/db/migration_postgres/V11__siren_webhook_task_and_workflow.sql new file mode 100644 index 0000000000..1db15ac536 --- /dev/null +++ b/postgres-persistence/src/main/resources/db/migration_postgres/V11__siren_webhook_task_and_workflow.sql @@ -0,0 +1,67 @@ +INSERT INTO + public.meta_task_def ("name", json_data) +VALUES +( + 'send_webhook_task', + json_build_object( + 'createTime' ,EXTRACT(epoch FROM CURRENT_TIMESTAMP)::bigint * 1000, + 'createdBy' ,'', + 'accessPolicy', jsonb '{}', + 'name' ,'send_webhook_task', + 'description' ,'Send Webhook Task', + 'retryCount' ,5, + 'timeoutSeconds' ,3600, + 'inputKeys' ,jsonb '[]', + 'outputKeys' ,jsonb '[]', + 'timeoutPolicy' ,'TIME_OUT_WF', + 'retryLogic' ,'EXPONENTIAL_BACKOFF', + 'retryDelaySeconds' ,10, + 'responseTimeoutSeconds' ,600, + 'inputTemplate', jsonb '{}', + 'rateLimitPerFrequency' ,0, + 'rateLimitFrequencyInSeconds' ,1, + 'ownerEmail' ,'admin@sirenapp.io', + 'backoffScaleFactor' ,1 + ) + ); + +INSERT INTO public.meta_workflow_def +( "name", "version", latest_version, json_data) +VALUES( + 'webhook_workflow', + 1, + 1, + json_build_object( + 'createTime',EXTRACT(epoch FROM CURRENT_TIMESTAMP)::bigint * 1000, + 'accessPolicy', jsonb '{}', + 'name','webhook_workflow', + 'description','Workflow for sending webhook', + 'version',1, + 'tasks', + json_build_array( + json_build_object( + 'name','send_webhook_task', + 'taskReferenceName','send_webhook_task_ref', + 'inputParameters', + json_build_object( + 'notificationAuditId',E'\u0024{workflow.input.notificationAuditId}' + ), + 'type','SIMPLE', + 'startDelay',0, + 'optional',true, + 'asyncComplete',false, + 'permissive',false + )), + 'inputParameters', jsonb '[]', + 'outputParameters',jsonb '{}', + 'schemaVersion',2, + 'restartable',true, + 'workflowStatusListenerEnabled',false, + 'ownerEmail','admin@sirenapp.io', + 'timeoutPolicy','ALERT_ONLY', + 'timeoutSeconds',0, + 'variables',jsonb '{}', + 'inputTemplate',jsonb '{}' + ) + ); + diff --git a/postgres-persistence/src/main/resources/db/migration_postgres/V9__siren_send_notification_task.sql b/postgres-persistence/src/main/resources/db/migration_postgres/V9__siren_send_notification_task.sql new file mode 100644 index 0000000000..13efbc1db0 --- /dev/null +++ b/postgres-persistence/src/main/resources/db/migration_postgres/V9__siren_send_notification_task.sql @@ -0,0 +1,27 @@ +INSERT INTO + public.meta_task_def ("name", json_data) +VALUES +( + 'send_notification_task', + json_build_object( + 'createTime', EXTRACT(epoch FROM CURRENT_TIMESTAMP)::bigint * 1000, + 'createdBy' ,'', + 'accessPolicy', jsonb '{}', + 'name' ,'send_notification_task', + 'description' ,'Send Notification Task', + 'retryCount' ,5, + 'timeoutSeconds' ,3600, + 'inputKeys' , jsonb '[]', + 'outputKeys' , jsonb '[]', + 'timeoutPolicy' ,'TIME_OUT_WF', + 'retryLogic' ,'EXPONENTIAL_BACKOFF', + 'retryDelaySeconds' ,10, + 'responseTimeoutSeconds' ,600, + 'inputTemplate', jsonb '{}', + 'rateLimitPerFrequency' ,0, + 'rateLimitFrequencyInSeconds' ,1, + 'ownerEmail' ,'admin@sirenapp.io', + 'backoffScaleFactor' ,1 + ) + ); + \ No newline at end of file From d215ff9d3afac8a1b977358404a14d158dbd4fb5 Mon Sep 17 00:00:00 2001 From: Muhammad Date: Tue, 20 Feb 2024 20:02:31 +0530 Subject: [PATCH 02/12] feat: Create initial workflows and tasks using eventlistener --- ...e_execution_workflow_and_event_handler.sql | 109 --------------- .../V11__siren_webhook_task_and_workflow.sql | 67 --------- .../V9__siren_send_notification_task.sql | 27 ---- .../rest/startup/SirenInitializer.java | 128 ++++++++++++++++++ ...finalizeWorkflowExecutionEventHandler.json | 26 ++++ .../tasks/finalizeWorkflowExecutionTask.json | 21 +++ .../siren/tasks/sendNotificationTask.json | 21 +++ .../siren/tasks/sendWebhookTask.json | 21 +++ .../sirenFinalizeExecutionWorkflow.json | 31 +++++ .../siren/workflows/sirenWebhookWorkflow.json | 30 ++++ 10 files changed, 278 insertions(+), 203 deletions(-) delete mode 100644 postgres-persistence/src/main/resources/db/migration_postgres/V10__siren_finalize_execution_workflow_and_event_handler.sql delete mode 100644 postgres-persistence/src/main/resources/db/migration_postgres/V11__siren_webhook_task_and_workflow.sql delete mode 100644 postgres-persistence/src/main/resources/db/migration_postgres/V9__siren_send_notification_task.sql create mode 100644 rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java create mode 100644 rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json create mode 100644 rest/src/main/resources/siren/tasks/finalizeWorkflowExecutionTask.json create mode 100644 rest/src/main/resources/siren/tasks/sendNotificationTask.json create mode 100644 rest/src/main/resources/siren/tasks/sendWebhookTask.json create mode 100644 rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json create mode 100644 rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json diff --git a/postgres-persistence/src/main/resources/db/migration_postgres/V10__siren_finalize_execution_workflow_and_event_handler.sql b/postgres-persistence/src/main/resources/db/migration_postgres/V10__siren_finalize_execution_workflow_and_event_handler.sql deleted file mode 100644 index ff9a20f4f5..0000000000 --- a/postgres-persistence/src/main/resources/db/migration_postgres/V10__siren_finalize_execution_workflow_and_event_handler.sql +++ /dev/null @@ -1,109 +0,0 @@ --- Enable workflow status listener in all workflow definitions -UPDATE public.meta_workflow_def -SET json_data = jsonb_set( - json_data::jsonb, - '{workflowStatusListenerEnabled}', - 'true'::jsonb -)::text; - -INSERT INTO - public.meta_task_def ("name", json_data) -VALUES -( - 'finalize_workflow_execution_task', - json_build_object( - 'createTime' ,EXTRACT(epoch FROM CURRENT_TIMESTAMP)::bigint * 1000, - 'createdBy' ,'', - 'accessPolicy', jsonb '{}', - 'name' ,'finalize_workflow_execution_task', - 'description' ,'Finalize Workflow Execution Task', - 'retryCount' ,5, - 'timeoutSeconds' ,3600, - 'inputKeys' ,jsonb '[]', - 'outputKeys' ,jsonb '[]', - 'timeoutPolicy' ,'TIME_OUT_WF', - 'retryLogic' ,'EXPONENTIAL_BACKOFF', - 'retryDelaySeconds' ,10, - 'responseTimeoutSeconds' ,600, - 'inputTemplate', jsonb '{}', - 'rateLimitPerFrequency' ,0, - 'rateLimitFrequencyInSeconds' ,1, - 'ownerEmail' ,'admin@sirenapp.io', - 'backoffScaleFactor' ,1 - ) - ); - -INSERT INTO - public.meta_workflow_def ("name", "version", latest_version, json_data) -VALUES( - 'finalize_workflow_execution', - 1, - 1, - json_build_object( - 'createTime',EXTRACT(epoch FROM CURRENT_TIMESTAMP)::bigint * 1000, - 'accessPolicy',jsonb '{}', - 'name','finalize_workflow_execution', - 'description','Workflow for finalizing workflow execution', - 'version',1, - 'tasks', - json_build_array(json_build_object( - 'name','finalize_workflow_execution_task', - 'taskReferenceName','finalize_workflow_execution_task_ref', - 'inputParameters', - json_build_object( - 'status',E'\u0024{workflow.input.status}', - 'externalExecutionId',E'\u0024{workflow.input.workflowId}' - ), - 'type','SIMPLE', - 'startDelay',0, - 'optional',false, - 'asyncComplete',false, - 'permissive',false - )), - 'inputParameters',jsonb '[]', - 'outputParameters',jsonb '{}', - 'schemaVersion',2, - 'restartable',true, - 'workflowStatusListenerEnabled',false, - 'ownerEmail','admin@sirenapp.io', - 'timeoutPolicy','ALERT_ONLY', - 'timeoutSeconds',0, - 'variables',jsonb '{}', - 'inputTemplate',jsonb '{}' - ) - ); - -INSERT INTO - public.meta_event_handler (id, "name", "event", active, json_data) -VALUES( - 1, - 'finalize_workflow_execution_event_handler', - 'conductor:finalize_workflow_execution_event', - true, - json_build_object( - 'name','finalize_workflow_execution_event_handler', - 'event','conductor:finalize_workflow_execution_event', - 'actions', - json_build_array( - json_build_object('action','start_workflow', - 'start_workflow', - json_build_object( - 'name','finalize_workflow_execution', - 'input',json_build_object( - 'workflowType',E'\u0024{workflowType}', - 'version',E'\u0024{version}', - 'workflowId',E'\u0024{workflowId}', - 'correlationId',E'\u0024{correlationId}', - 'status',E'\u0024{status}', - 'input',E'\u0024{input}', - 'output',E'\u0024{output}', - 'reasonForIncompletion',E'\u0024{reasonForIncompletion}', - 'executionTime',E'\u0024{executionTime}', - 'event',E'\u0024{event}') - ) - ) - ), - 'active',true - ) - ); - diff --git a/postgres-persistence/src/main/resources/db/migration_postgres/V11__siren_webhook_task_and_workflow.sql b/postgres-persistence/src/main/resources/db/migration_postgres/V11__siren_webhook_task_and_workflow.sql deleted file mode 100644 index 1db15ac536..0000000000 --- a/postgres-persistence/src/main/resources/db/migration_postgres/V11__siren_webhook_task_and_workflow.sql +++ /dev/null @@ -1,67 +0,0 @@ -INSERT INTO - public.meta_task_def ("name", json_data) -VALUES -( - 'send_webhook_task', - json_build_object( - 'createTime' ,EXTRACT(epoch FROM CURRENT_TIMESTAMP)::bigint * 1000, - 'createdBy' ,'', - 'accessPolicy', jsonb '{}', - 'name' ,'send_webhook_task', - 'description' ,'Send Webhook Task', - 'retryCount' ,5, - 'timeoutSeconds' ,3600, - 'inputKeys' ,jsonb '[]', - 'outputKeys' ,jsonb '[]', - 'timeoutPolicy' ,'TIME_OUT_WF', - 'retryLogic' ,'EXPONENTIAL_BACKOFF', - 'retryDelaySeconds' ,10, - 'responseTimeoutSeconds' ,600, - 'inputTemplate', jsonb '{}', - 'rateLimitPerFrequency' ,0, - 'rateLimitFrequencyInSeconds' ,1, - 'ownerEmail' ,'admin@sirenapp.io', - 'backoffScaleFactor' ,1 - ) - ); - -INSERT INTO public.meta_workflow_def -( "name", "version", latest_version, json_data) -VALUES( - 'webhook_workflow', - 1, - 1, - json_build_object( - 'createTime',EXTRACT(epoch FROM CURRENT_TIMESTAMP)::bigint * 1000, - 'accessPolicy', jsonb '{}', - 'name','webhook_workflow', - 'description','Workflow for sending webhook', - 'version',1, - 'tasks', - json_build_array( - json_build_object( - 'name','send_webhook_task', - 'taskReferenceName','send_webhook_task_ref', - 'inputParameters', - json_build_object( - 'notificationAuditId',E'\u0024{workflow.input.notificationAuditId}' - ), - 'type','SIMPLE', - 'startDelay',0, - 'optional',true, - 'asyncComplete',false, - 'permissive',false - )), - 'inputParameters', jsonb '[]', - 'outputParameters',jsonb '{}', - 'schemaVersion',2, - 'restartable',true, - 'workflowStatusListenerEnabled',false, - 'ownerEmail','admin@sirenapp.io', - 'timeoutPolicy','ALERT_ONLY', - 'timeoutSeconds',0, - 'variables',jsonb '{}', - 'inputTemplate',jsonb '{}' - ) - ); - diff --git a/postgres-persistence/src/main/resources/db/migration_postgres/V9__siren_send_notification_task.sql b/postgres-persistence/src/main/resources/db/migration_postgres/V9__siren_send_notification_task.sql deleted file mode 100644 index 13efbc1db0..0000000000 --- a/postgres-persistence/src/main/resources/db/migration_postgres/V9__siren_send_notification_task.sql +++ /dev/null @@ -1,27 +0,0 @@ -INSERT INTO - public.meta_task_def ("name", json_data) -VALUES -( - 'send_notification_task', - json_build_object( - 'createTime', EXTRACT(epoch FROM CURRENT_TIMESTAMP)::bigint * 1000, - 'createdBy' ,'', - 'accessPolicy', jsonb '{}', - 'name' ,'send_notification_task', - 'description' ,'Send Notification Task', - 'retryCount' ,5, - 'timeoutSeconds' ,3600, - 'inputKeys' , jsonb '[]', - 'outputKeys' , jsonb '[]', - 'timeoutPolicy' ,'TIME_OUT_WF', - 'retryLogic' ,'EXPONENTIAL_BACKOFF', - 'retryDelaySeconds' ,10, - 'responseTimeoutSeconds' ,600, - 'inputTemplate', jsonb '{}', - 'rateLimitPerFrequency' ,0, - 'rateLimitFrequencyInSeconds' ,1, - 'ownerEmail' ,'admin@sirenapp.io', - 'backoffScaleFactor' ,1 - ) - ); - \ No newline at end of file diff --git a/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java b/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java new file mode 100644 index 0000000000..09c7d3ccde --- /dev/null +++ b/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java @@ -0,0 +1,128 @@ +package com.netflix.conductor.rest.startup; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.context.event.EventListener; +import org.springframework.core.io.Resource; +import org.springframework.http.HttpEntity; +import org.springframework.stereotype.Component; +import org.springframework.util.FileCopyUtils; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; + +import static org.springframework.http.HttpHeaders.CONTENT_TYPE; +import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; + +@Component +public class SirenInitializer { + + private static final Logger LOGGER = LoggerFactory.getLogger(SirenInitializer.class); + + private final RestTemplate restTemplate; + + @Value("${server.port:8080}") + private int port; + + @Value("classpath:./siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json") + private Resource finalizeWorkflowExecutionEventHandler; + + @Value("classpath:./siren/tasks/finalizeWorkflowExecutionTask.json") + private Resource finalizeWorkflowExecutionTask; + + @Value("classpath:./siren/tasks/sendNotificationTask.json") + private Resource sendNotificationTask; + + @Value("classpath:./siren/tasks/sendWebhookTask.json") + private Resource sendWebhookTask; + + @Value("classpath:./siren/workflows/sirenFinalizeExecutionWorkflow.json") + private Resource sirenFinalizeExecutionWorkflow; + + @Value("classpath:./siren/workflows/sirenWebhookWorkflow.json") + private Resource sirenWebhookWorkflow; + + public SirenInitializer(RestTemplateBuilder restTemplateBuilder) { + this.restTemplate = restTemplateBuilder.build(); + } + + @EventListener(ApplicationReadyEvent.class) + public void setupSirenResources() { + LOGGER.info("Loading siren resources"); + createSirenResources(); + } + + private void createSirenResources() { + MultiValueMap headers = new LinkedMultiValueMap<>(); + headers.add(CONTENT_TYPE, APPLICATION_JSON_VALUE); + createWorkflow(sirenFinalizeExecutionWorkflow, headers, "sirenFinalizeExecutionWorkflow"); + createWorkflow(sirenWebhookWorkflow, headers, "sirenWebhookWorkflow"); + LOGGER.info("Siren workflows are created"); + + createTask(sendNotificationTask, headers, "sendNotificationTask"); + createTask(sendWebhookTask, headers, "sendWebhookTask"); + createTask(finalizeWorkflowExecutionTask, headers, "finalizeWorkflowExecutionTask"); + LOGGER.info("Siren tasks are created"); + + createEventHandler( + finalizeWorkflowExecutionEventHandler, + headers, + "finalizeWorkflowExecutionEventHandler"); + LOGGER.info("Siren event handlers are created"); + } + + private void createWorkflow( + Resource resource, MultiValueMap headers, String workflowName) { + try { + HttpEntity request = new HttpEntity<>(readToString(resource), headers); + restTemplate.postForEntity(url("/api/metadata/workflow"), request, Map.class); + } catch (RestClientException e) { + LOGGER.info("Skipping create {} ", workflowName); + e.printStackTrace(); + } + } + + private void createTask( + Resource resource, MultiValueMap headers, String taskName) { + try { + HttpEntity request = new HttpEntity<>(readToString(resource), headers); + restTemplate.postForEntity(url("/api/metadata/taskdefs"), request, Map.class); + } catch (RestClientException e) { + LOGGER.info("Skipping create {} ", taskName); + e.printStackTrace(); + } + } + + private void createEventHandler( + Resource resource, MultiValueMap headers, String eventHandlerName) { + try { + HttpEntity request = new HttpEntity<>(readToString(resource), headers); + restTemplate.postForEntity(url("/api/event"), request, Map.class); + } catch (RestClientException e) { + LOGGER.info("Skipping create {} ", eventHandlerName); + e.printStackTrace(); + } + } + + private String readToString(Resource resource) { + try { + return FileCopyUtils.copyToString(new InputStreamReader(resource.getInputStream())); + } catch (IOException e) { + LOGGER.error("Error while loading siren resources", e); + throw new RuntimeException("Error reading resources", e); + } + } + + private String url(String path) { + // TODO replace with url + return "http://localhost:" + port + path; + } +} diff --git a/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json b/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json new file mode 100644 index 0000000000..a640a28c5e --- /dev/null +++ b/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json @@ -0,0 +1,26 @@ +{ + "name": "finalize_workflow_execution_event_handler", + "event": "conductor:finalize_workflow_execution_event", + "actions": [ + { + "action": "start_workflow", + "start_workflow": { + "name": "finalize_workflow_execution", + "input": { + "workflowType": "${workflowType}", + "version": "${version}", + "workflowId": "${workflowId}", + "correlationId": "${correlationId}", + "status": "${status}", + "input": "${input}", + "output": "${output}", + "reasonForIncompletion": "${reasonForIncompletion}", + "executionTime": "${executionTime}", + "event": "${event}" + } + }, + "expandInlineJSON": false + } + ], + "active": true +} \ No newline at end of file diff --git a/rest/src/main/resources/siren/tasks/finalizeWorkflowExecutionTask.json b/rest/src/main/resources/siren/tasks/finalizeWorkflowExecutionTask.json new file mode 100644 index 0000000000..eb19e7a45e --- /dev/null +++ b/rest/src/main/resources/siren/tasks/finalizeWorkflowExecutionTask.json @@ -0,0 +1,21 @@ +[ + { + "createdBy": "", + "accessPolicy": {}, + "name": "finalize_workflow_execution_task", + "description": "Finalize Workflow Execution Task", + "retryCount": 5, + "timeoutSeconds": 3600, + "inputKeys": [], + "outputKeys": [], + "timeoutPolicy": "TIME_OUT_WF", + "retryLogic": "EXPONENTIAL_BACKOFF", + "retryDelaySeconds": 10, + "responseTimeoutSeconds": 600, + "inputTemplate": {}, + "rateLimitPerFrequency": 0, + "rateLimitFrequencyInSeconds": 1, + "ownerEmail": "admin@sirenapp.io", + "backoffScaleFactor": 1 + } +] diff --git a/rest/src/main/resources/siren/tasks/sendNotificationTask.json b/rest/src/main/resources/siren/tasks/sendNotificationTask.json new file mode 100644 index 0000000000..4d331f70d5 --- /dev/null +++ b/rest/src/main/resources/siren/tasks/sendNotificationTask.json @@ -0,0 +1,21 @@ +[ + { + "createdBy": "", + "accessPolicy": {}, + "name": "send_notification_task", + "description": "Send Notification Task", + "retryCount": 5, + "timeoutSeconds": 3600, + "inputKeys": [], + "outputKeys": [], + "timeoutPolicy": "TIME_OUT_WF", + "retryLogic": "EXPONENTIAL_BACKOFF", + "retryDelaySeconds": 10, + "responseTimeoutSeconds": 600, + "inputTemplate": {}, + "rateLimitPerFrequency": 0, + "rateLimitFrequencyInSeconds": 1, + "ownerEmail": "admin@sirenapp.io", + "backoffScaleFactor": 1 + } +] diff --git a/rest/src/main/resources/siren/tasks/sendWebhookTask.json b/rest/src/main/resources/siren/tasks/sendWebhookTask.json new file mode 100644 index 0000000000..1878c2aaa0 --- /dev/null +++ b/rest/src/main/resources/siren/tasks/sendWebhookTask.json @@ -0,0 +1,21 @@ +[ + { + "createdBy": "", + "accessPolicy": {}, + "name": "send_webhook_task", + "description": "Send Webhook Task", + "retryCount": 5, + "timeoutSeconds": 3600, + "inputKeys": [], + "outputKeys": [], + "timeoutPolicy": "TIME_OUT_WF", + "retryLogic": "EXPONENTIAL_BACKOFF", + "retryDelaySeconds": 10, + "responseTimeoutSeconds": 600, + "inputTemplate": {}, + "rateLimitPerFrequency": 0, + "rateLimitFrequencyInSeconds": 1, + "ownerEmail": "admin@sirenapp.io", + "backoffScaleFactor": 1 + } +] diff --git a/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json b/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json new file mode 100644 index 0000000000..5a2ed11608 --- /dev/null +++ b/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json @@ -0,0 +1,31 @@ +{ + "accessPolicy": {}, + "name": "siren_finalize_execution_workflow", + "description": "Edit or extend this sample workflow. Set the workflow name to get started", + "version": 1, + "tasks": [ + { + "name": "finalize_workflow_execution_task", + "taskReferenceName": "finalize_workflow_execution_task_ref", + "inputParameters": { + "status": "${workflow.input.status}", + "externalExecutionId": "${workflow.input.workflowId}" + }, + "type": "SIMPLE", + "startDelay": 0, + "optional": false, + "asyncComplete": false, + "permissive": false + } + ], + "inputParameters": [], + "outputParameters": {}, + "schemaVersion": 2, + "restartable": true, + "workflowStatusListenerEnabled": false, + "ownerEmail": "example@email.com", + "timeoutPolicy": "ALERT_ONLY", + "timeoutSeconds": 0, + "variables": {}, + "inputTemplate": {} +} \ No newline at end of file diff --git a/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json b/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json new file mode 100644 index 0000000000..a72a229b09 --- /dev/null +++ b/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json @@ -0,0 +1,30 @@ +{ + "accessPolicy": {}, + "name": "siren_webhook_workflow", + "description": "Workflow for sending webhook", + "version": 1, + "tasks": [ + { + "name": "send_webhook_task", + "taskReferenceName": "send_webhook_task_ref", + "inputParameters": { + "notificationAuditId": "${workflow.input.notificationAuditId}" + }, + "type": "SIMPLE", + "startDelay": 0, + "optional": true, + "asyncComplete": false, + "permissive": false + } + ], + "inputParameters": [], + "outputParameters": {}, + "schemaVersion": 2, + "restartable": true, + "workflowStatusListenerEnabled": false, + "ownerEmail": "admin@sirenapp.io", + "timeoutPolicy": "ALERT_ONLY", + "timeoutSeconds": 0, + "variables": {}, + "inputTemplate": {} +} \ No newline at end of file From 15b71f40964a8e8342bfb017953572e3adefbb8b Mon Sep 17 00:00:00 2001 From: Muhammad Date: Tue, 20 Feb 2024 20:05:42 +0530 Subject: [PATCH 03/12] refactor: Add new line at EOF --- .../eventhandlers/finalizeWorkflowExecutionEventHandler.json | 2 +- .../siren/workflows/sirenFinalizeExecutionWorkflow.json | 2 +- .../main/resources/siren/workflows/sirenWebhookWorkflow.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json b/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json index a640a28c5e..4872db183b 100644 --- a/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json +++ b/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json @@ -23,4 +23,4 @@ } ], "active": true -} \ No newline at end of file +} diff --git a/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json b/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json index 5a2ed11608..f4db2ccbfb 100644 --- a/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json +++ b/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json @@ -28,4 +28,4 @@ "timeoutSeconds": 0, "variables": {}, "inputTemplate": {} -} \ No newline at end of file +} diff --git a/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json b/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json index a72a229b09..3096211317 100644 --- a/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json +++ b/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json @@ -27,4 +27,4 @@ "timeoutSeconds": 0, "variables": {}, "inputTemplate": {} -} \ No newline at end of file +} From 12e613ffe9345393d071965b062de685e3e3b897 Mon Sep 17 00:00:00 2001 From: Muhammad Date: Wed, 21 Feb 2024 09:49:07 +0530 Subject: [PATCH 04/12] feat: Handle errors while creating already existing resources --- .../rest/startup/SirenInitializer.java | 71 ++++++++++--------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java b/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java index 09c7d3ccde..71d964ed8e 100644 --- a/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java +++ b/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java @@ -1,3 +1,15 @@ +/* + * Copyright 2024 Conductor Authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ package com.netflix.conductor.rest.startup; import java.io.IOException; @@ -24,13 +36,13 @@ @Component public class SirenInitializer { - + private static final String ALREADY_EXISTS_KEYWORD = "already exists"; private static final Logger LOGGER = LoggerFactory.getLogger(SirenInitializer.class); private final RestTemplate restTemplate; - @Value("${server.port:8080}") - private int port; + @Value("${server.url:http://localhost:8080}") + private String url; @Value("classpath:./siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json") private Resource finalizeWorkflowExecutionEventHandler; @@ -63,52 +75,52 @@ public void setupSirenResources() { private void createSirenResources() { MultiValueMap headers = new LinkedMultiValueMap<>(); headers.add(CONTENT_TYPE, APPLICATION_JSON_VALUE); - createWorkflow(sirenFinalizeExecutionWorkflow, headers, "sirenFinalizeExecutionWorkflow"); - createWorkflow(sirenWebhookWorkflow, headers, "sirenWebhookWorkflow"); + createWorkflow(sirenFinalizeExecutionWorkflow, headers); + createWorkflow(sirenWebhookWorkflow, headers); LOGGER.info("Siren workflows are created"); - createTask(sendNotificationTask, headers, "sendNotificationTask"); - createTask(sendWebhookTask, headers, "sendWebhookTask"); - createTask(finalizeWorkflowExecutionTask, headers, "finalizeWorkflowExecutionTask"); + createTask(sendNotificationTask, headers); + createTask(sendWebhookTask, headers); + createTask(finalizeWorkflowExecutionTask, headers); LOGGER.info("Siren tasks are created"); - createEventHandler( - finalizeWorkflowExecutionEventHandler, - headers, - "finalizeWorkflowExecutionEventHandler"); + createEventHandler(finalizeWorkflowExecutionEventHandler, headers); LOGGER.info("Siren event handlers are created"); } - private void createWorkflow( - Resource resource, MultiValueMap headers, String workflowName) { + private void createWorkflow(Resource resource, MultiValueMap headers) { try { HttpEntity request = new HttpEntity<>(readToString(resource), headers); - restTemplate.postForEntity(url("/api/metadata/workflow"), request, Map.class); + restTemplate.postForEntity(url + "/api/metadata/workflow", request, Map.class); } catch (RestClientException e) { - LOGGER.info("Skipping create {} ", workflowName); - e.printStackTrace(); + handleException(e); } } - private void createTask( - Resource resource, MultiValueMap headers, String taskName) { + private void createTask(Resource resource, MultiValueMap headers) { try { HttpEntity request = new HttpEntity<>(readToString(resource), headers); - restTemplate.postForEntity(url("/api/metadata/taskdefs"), request, Map.class); + restTemplate.postForEntity(url + "/api/metadata/taskdefs", request, Map.class); } catch (RestClientException e) { - LOGGER.info("Skipping create {} ", taskName); - e.printStackTrace(); + handleException(e); } } - private void createEventHandler( - Resource resource, MultiValueMap headers, String eventHandlerName) { + private void createEventHandler(Resource resource, MultiValueMap headers) { try { HttpEntity request = new HttpEntity<>(readToString(resource), headers); - restTemplate.postForEntity(url("/api/event"), request, Map.class); + restTemplate.postForEntity(url + "/api/event", request, Map.class); } catch (RestClientException e) { - LOGGER.info("Skipping create {} ", eventHandlerName); - e.printStackTrace(); + handleException(e); + } + } + + private void handleException(RestClientException e) { + if (e.getMessage().contains(ALREADY_EXISTS_KEYWORD)) { + LOGGER.info("Skipping creation: {}", e.getMessage()); + } else { + LOGGER.error("Error while creation ", e); + throw e; } } @@ -120,9 +132,4 @@ private String readToString(Resource resource) { throw new RuntimeException("Error reading resources", e); } } - - private String url(String path) { - // TODO replace with url - return "http://localhost:" + port + path; - } } From a63195f6a67aec6af0e03c507a817b68be6c1f3a Mon Sep 17 00:00:00 2001 From: Muhammad Date: Wed, 21 Feb 2024 10:05:48 +0530 Subject: [PATCH 05/12] refactor: Refactor update task method --- .../conductor/rest/startup/SirenInitializer.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java b/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java index 71d964ed8e..6456077bf7 100644 --- a/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java +++ b/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java @@ -79,9 +79,9 @@ private void createSirenResources() { createWorkflow(sirenWebhookWorkflow, headers); LOGGER.info("Siren workflows are created"); - createTask(sendNotificationTask, headers); - createTask(sendWebhookTask, headers); - createTask(finalizeWorkflowExecutionTask, headers); + updateTask(sendNotificationTask, headers); + updateTask(sendWebhookTask, headers); + updateTask(finalizeWorkflowExecutionTask, headers); LOGGER.info("Siren tasks are created"); createEventHandler(finalizeWorkflowExecutionEventHandler, headers); @@ -97,13 +97,9 @@ private void createWorkflow(Resource resource, MultiValueMap hea } } - private void createTask(Resource resource, MultiValueMap headers) { - try { - HttpEntity request = new HttpEntity<>(readToString(resource), headers); - restTemplate.postForEntity(url + "/api/metadata/taskdefs", request, Map.class); - } catch (RestClientException e) { - handleException(e); - } + private void updateTask(Resource resource, MultiValueMap headers) { + HttpEntity request = new HttpEntity<>(readToString(resource), headers); + restTemplate.postForEntity(url + "/api/metadata/taskdefs", request, Map.class); } private void createEventHandler(Resource resource, MultiValueMap headers) { From 4d7924eaffecd12b9220afd89b635321cbd69a36 Mon Sep 17 00:00:00 2001 From: Muhammad Date: Wed, 21 Feb 2024 10:08:07 +0530 Subject: [PATCH 06/12] feat: Update finalize execution workflow description --- .../siren/workflows/sirenFinalizeExecutionWorkflow.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json b/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json index f4db2ccbfb..c9494465ba 100644 --- a/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json +++ b/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json @@ -1,7 +1,7 @@ { "accessPolicy": {}, "name": "siren_finalize_execution_workflow", - "description": "Edit or extend this sample workflow. Set the workflow name to get started", + "description": "Workflow for finalizing workflow execution", "version": 1, "tasks": [ { From bf571b270f6d0592fe5df9a090f603503c8f3170 Mon Sep 17 00:00:00 2001 From: Muhammad Date: Wed, 21 Feb 2024 11:40:23 +0530 Subject: [PATCH 07/12] feat: Update api url --- .../netflix/conductor/rest/startup/SirenInitializer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java b/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java index 6456077bf7..ec15526456 100644 --- a/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java +++ b/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java @@ -91,7 +91,7 @@ private void createSirenResources() { private void createWorkflow(Resource resource, MultiValueMap headers) { try { HttpEntity request = new HttpEntity<>(readToString(resource), headers); - restTemplate.postForEntity(url + "/api/metadata/workflow", request, Map.class); + restTemplate.postForEntity(url + "/api/metadata/workflow/", request, Map.class); } catch (RestClientException e) { handleException(e); } @@ -99,13 +99,13 @@ private void createWorkflow(Resource resource, MultiValueMap hea private void updateTask(Resource resource, MultiValueMap headers) { HttpEntity request = new HttpEntity<>(readToString(resource), headers); - restTemplate.postForEntity(url + "/api/metadata/taskdefs", request, Map.class); + restTemplate.postForEntity(url + "/api/metadata/taskdefs/", request, Map.class); } private void createEventHandler(Resource resource, MultiValueMap headers) { try { HttpEntity request = new HttpEntity<>(readToString(resource), headers); - restTemplate.postForEntity(url + "/api/event", request, Map.class); + restTemplate.postForEntity(url + "/api/event/", request, Map.class); } catch (RestClientException e) { handleException(e); } From 9933a0b34e514876e263ae4618dae3f7e9ce3a4a Mon Sep 17 00:00:00 2001 From: Sreeraj Rajeendran Date: Thu, 29 Feb 2024 18:44:48 +0530 Subject: [PATCH 08/12] fix: Initialize Siren resources as per property value * Without the property value check, build test was failing during integration test --- .../conductor/rest/startup/SirenInitializer.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java b/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java index ec15526456..f3a5a50970 100644 --- a/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java +++ b/rest/src/main/java/com/netflix/conductor/rest/startup/SirenInitializer.java @@ -41,6 +41,9 @@ public class SirenInitializer { private final RestTemplate restTemplate; + @Value("${loadSirenResources:false}") + private boolean loadSirenResources; + @Value("${server.url:http://localhost:8080}") private String url; @@ -68,8 +71,10 @@ public SirenInitializer(RestTemplateBuilder restTemplateBuilder) { @EventListener(ApplicationReadyEvent.class) public void setupSirenResources() { - LOGGER.info("Loading siren resources"); - createSirenResources(); + if (loadSirenResources) { + LOGGER.info("Loading siren resources"); + createSirenResources(); + } } private void createSirenResources() { @@ -91,7 +96,7 @@ private void createSirenResources() { private void createWorkflow(Resource resource, MultiValueMap headers) { try { HttpEntity request = new HttpEntity<>(readToString(resource), headers); - restTemplate.postForEntity(url + "/api/metadata/workflow/", request, Map.class); + restTemplate.postForEntity(url + "/api/metadata/workflow", request, Map.class); } catch (RestClientException e) { handleException(e); } @@ -99,13 +104,13 @@ private void createWorkflow(Resource resource, MultiValueMap hea private void updateTask(Resource resource, MultiValueMap headers) { HttpEntity request = new HttpEntity<>(readToString(resource), headers); - restTemplate.postForEntity(url + "/api/metadata/taskdefs/", request, Map.class); + restTemplate.postForEntity(url + "/api/metadata/taskdefs", request, Map.class); } private void createEventHandler(Resource resource, MultiValueMap headers) { try { HttpEntity request = new HttpEntity<>(readToString(resource), headers); - restTemplate.postForEntity(url + "/api/event/", request, Map.class); + restTemplate.postForEntity(url + "/api/event", request, Map.class); } catch (RestClientException e) { handleException(e); } From ac791a55f504d915293b683d28dec50e35d2d16c Mon Sep 17 00:00:00 2001 From: Muhammad Date: Mon, 4 Mar 2024 11:43:06 +0530 Subject: [PATCH 09/12] feat: Add traceId to sirenWebhookWorkflow --- .../main/resources/siren/workflows/sirenWebhookWorkflow.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json b/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json index 3096211317..368f988e9a 100644 --- a/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json +++ b/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json @@ -8,7 +8,8 @@ "name": "send_webhook_task", "taskReferenceName": "send_webhook_task_ref", "inputParameters": { - "notificationAuditId": "${workflow.input.notificationAuditId}" + "notificationAuditId": "${workflow.input.notificationAuditId}", + "traceId":"${workflow.input.traceId}" }, "type": "SIMPLE", "startDelay": 0, From dcf2aff93f2455292d2c11afde3436cec4674f32 Mon Sep 17 00:00:00 2001 From: Muhammad Date: Mon, 4 Mar 2024 11:50:04 +0530 Subject: [PATCH 10/12] fix: Correct workflow name in event handler --- .../eventhandlers/finalizeWorkflowExecutionEventHandler.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json b/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json index 4872db183b..5d5ab7b733 100644 --- a/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json +++ b/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json @@ -5,7 +5,7 @@ { "action": "start_workflow", "start_workflow": { - "name": "finalize_workflow_execution", + "name": "siren_finalize_execution_workflow", "input": { "workflowType": "${workflowType}", "version": "${version}", From 175dcb898b3289fb3834b3ae7754ed7febb2ecbe Mon Sep 17 00:00:00 2001 From: Muhammad Date: Tue, 5 Mar 2024 12:18:45 +0530 Subject: [PATCH 11/12] feat: Add workflow input to finalize_workflow_execution_task input-params --- .../eventhandlers/finalizeWorkflowExecutionEventHandler.json | 4 ++-- .../siren/workflows/sirenFinalizeExecutionWorkflow.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json b/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json index 5d5ab7b733..10a446ccec 100644 --- a/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json +++ b/rest/src/main/resources/siren/eventhandlers/finalizeWorkflowExecutionEventHandler.json @@ -12,14 +12,14 @@ "workflowId": "${workflowId}", "correlationId": "${correlationId}", "status": "${status}", - "input": "${input}", + "workflowInput": "${input}", "output": "${output}", "reasonForIncompletion": "${reasonForIncompletion}", "executionTime": "${executionTime}", "event": "${event}" } }, - "expandInlineJSON": false + "expandInlineJSON": true } ], "active": true diff --git a/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json b/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json index c9494465ba..fcaaddfee1 100644 --- a/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json +++ b/rest/src/main/resources/siren/workflows/sirenFinalizeExecutionWorkflow.json @@ -9,7 +9,8 @@ "taskReferenceName": "finalize_workflow_execution_task_ref", "inputParameters": { "status": "${workflow.input.status}", - "externalExecutionId": "${workflow.input.workflowId}" + "externalExecutionId": "${workflow.input.workflowId}", + "input": "${workflow.input.workflowInput}" }, "type": "SIMPLE", "startDelay": 0, From 1ed26e8b88d383b63318137f8c085aa2f9f21ee2 Mon Sep 17 00:00:00 2001 From: Muhammad Date: Wed, 6 Mar 2024 11:18:30 +0530 Subject: [PATCH 12/12] feat: Remove traceId param from siren webhook workflow --- .../main/resources/siren/workflows/sirenWebhookWorkflow.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json b/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json index 368f988e9a..450505f423 100644 --- a/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json +++ b/rest/src/main/resources/siren/workflows/sirenWebhookWorkflow.json @@ -9,7 +9,7 @@ "taskReferenceName": "send_webhook_task_ref", "inputParameters": { "notificationAuditId": "${workflow.input.notificationAuditId}", - "traceId":"${workflow.input.traceId}" + "workflowExecutionId": "${workflow.input.workflowExecutionId}" }, "type": "SIMPLE", "startDelay": 0,