From 775e630cfd0846c75f5d25219f413127b4d4c3a7 Mon Sep 17 00:00:00 2001 From: Walter Medvedeo Date: Fri, 16 Feb 2024 09:10:24 +0100 Subject: [PATCH] kie-kogito-serverless-operator-395: Workflow not registering to DataIndex if started simultaneously (#396) --- controllers/platform/services/properties.go | 1 + .../common/constants/platform_services.go | 17 +++++++++-------- .../common/properties/application_test.go | 5 ++++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/controllers/platform/services/properties.go b/controllers/platform/services/properties.go index c541f5b04..55bf0ec85 100644 --- a/controllers/platform/services/properties.go +++ b/controllers/platform/services/properties.go @@ -165,6 +165,7 @@ func GenerateDataIndexWorkflowProperties(workflow *operatorapi.SonataFlow, platf di := NewDataIndexHandler(platform) if workflow != nil && !profiles.IsDevProfile(workflow) && di.IsServiceEnabled() { props.Set(constants.KogitoProcessDefinitionsEventsEnabled, "true") + props.Set(constants.KogitoProcessDefinitionsEventsErrorsEnabled, "true") props.Set(constants.KogitoProcessInstancesEventsEnabled, "true") props.Set(constants.KogitoDataIndexHealthCheckEnabled, "true") di := NewDataIndexHandler(platform) diff --git a/controllers/profiles/common/constants/platform_services.go b/controllers/profiles/common/constants/platform_services.go index e0f249273..c0bc5086a 100644 --- a/controllers/profiles/common/constants/platform_services.go +++ b/controllers/profiles/common/constants/platform_services.go @@ -34,14 +34,15 @@ const ( JobServiceDataSourceReactiveURL = "quarkus.datasource.reactive.url" JobServiceJobEventsPath = "/v2/jobs/events" - KogitoProcessEventsProtocol = "http" - KogitoProcessInstancesEventsURL = "mp.messaging.outgoing.kogito-processinstances-events.url" - KogitoProcessInstancesEventsEnabled = "kogito.events.processinstances.enabled" - KogitoProcessInstancesEventsPath = "/processes" - KogitoProcessDefinitionsEventsURL = "mp.messaging.outgoing.kogito-processdefinitions-events.url" - KogitoProcessDefinitionsEventsEnabled = "kogito.events.processdefinitions.enabled" - KogitoProcessDefinitionsEventsPath = "/definitions" - KogitoUserTasksEventsEnabled = "kogito.events.usertasks.enabled" + KogitoProcessEventsProtocol = "http" + KogitoProcessInstancesEventsURL = "mp.messaging.outgoing.kogito-processinstances-events.url" + KogitoProcessInstancesEventsEnabled = "kogito.events.processinstances.enabled" + KogitoProcessInstancesEventsPath = "/processes" + KogitoProcessDefinitionsEventsURL = "mp.messaging.outgoing.kogito-processdefinitions-events.url" + KogitoProcessDefinitionsEventsEnabled = "kogito.events.processdefinitions.enabled" + KogitoProcessDefinitionsEventsErrorsEnabled = "kogito.events.processdefinitions.errors.propagate" + KogitoProcessDefinitionsEventsPath = "/definitions" + KogitoUserTasksEventsEnabled = "kogito.events.usertasks.enabled" // KogitoDataIndexHealthCheckEnabled configures if a workflow must check for the data index availability as part // of its start health check. KogitoDataIndexHealthCheckEnabled = "kogito.data-index.health-enabled" diff --git a/controllers/profiles/common/properties/application_test.go b/controllers/profiles/common/properties/application_test.go index d0f4d5dff..ea865b319 100644 --- a/controllers/profiles/common/properties/application_test.go +++ b/controllers/profiles/common/properties/application_test.go @@ -242,11 +242,12 @@ func Test_appPropertyHandler_WithServicesWithUserOverrides(t *testing.T) { assert.NoError(t, err) generatedProps, propsErr = properties.LoadString(props.WithUserProperties(userProperties).Build()) assert.NoError(t, propsErr) - assert.Equal(t, 16, len(generatedProps.Keys())) + assert.Equal(t, 17, len(generatedProps.Keys())) assert.NotContains(t, "property1", generatedProps.Keys()) assert.NotContains(t, "property2", generatedProps.Keys()) assert.Equal(t, "http://"+platform.Name+"-"+constants.DataIndexServiceName+"."+platform.Namespace+"/definitions", generatedProps.GetString(constants.KogitoProcessDefinitionsEventsURL, "")) assert.Equal(t, "true", generatedProps.GetString(constants.KogitoProcessDefinitionsEventsEnabled, "")) + assert.Equal(t, "true", generatedProps.GetString(constants.KogitoProcessDefinitionsEventsErrorsEnabled, "")) assert.Equal(t, "http://"+platform.Name+"-"+constants.DataIndexServiceName+"."+platform.Namespace+"/processes", generatedProps.GetString(constants.KogitoProcessInstancesEventsURL, "")) assert.Equal(t, "true", generatedProps.GetString(constants.KogitoProcessInstancesEventsEnabled, "")) assert.Equal(t, "http://"+platform.Name+"-"+constants.JobServiceName+"."+platform.Namespace+"/v2/jobs/events", generatedProps.GetString(constants.JobServiceRequestEventsURL, "")) @@ -529,6 +530,7 @@ func generateDataIndexWorkflowProductionProperties() *properties.Properties { dataIndexProdProperties.Set("mp.messaging.outgoing.kogito-processdefinitions-events.url", "http://foo-data-index-service.default/definitions") dataIndexProdProperties.Set("mp.messaging.outgoing.kogito-processinstances-events.url", "http://foo-data-index-service.default/processes") dataIndexProdProperties.Set("kogito.events.processdefinitions.enabled", "true") + dataIndexProdProperties.Set("kogito.events.processdefinitions.errors.propagate", "true") dataIndexProdProperties.Set("kogito.events.processinstances.enabled", "true") dataIndexProdProperties.Set("kogito.events.usertasks.enabled", "false") dataIndexProdProperties.Sort() @@ -570,6 +572,7 @@ func generateDataIndexAndJobServiceWorkflowProductionProperties() *properties.Pr dataIndexJobServiceProdProperties.Set("mp.messaging.outgoing.kogito-job-service-job-request-events.connector", "quarkus-http") dataIndexJobServiceProdProperties.Set("mp.messaging.outgoing.kogito-job-service-job-request-events.url", "http://foo-jobs-service.default/v2/jobs/events") dataIndexJobServiceProdProperties.Set("kogito.events.processdefinitions.enabled", "true") + dataIndexJobServiceProdProperties.Set("kogito.events.processdefinitions.errors.propagate", "true") dataIndexJobServiceProdProperties.Set("kogito.events.processinstances.enabled", "true") dataIndexJobServiceProdProperties.Set("kogito.events.usertasks.enabled", "false") dataIndexJobServiceProdProperties.Set("mp.messaging.outgoing.kogito-processdefinitions-events.url", "http://foo-data-index-service.default/definitions")