Skip to content

Commit

Permalink
SRVLOGIC-229: Workflow not registering to DataIndex if started simult…
Browse files Browse the repository at this point in the history
…aneously

    - kie-kogito-serverless-operator-395: Workflow not registering to DataIndex if started simultaneously (apache#396)

     (cherry picked from commit 775e630)
  • Loading branch information
wmedvede committed Feb 19, 2024
1 parent eb3ccf9 commit 165c705
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions controllers/platform/services/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 9 additions & 8 deletions controllers/profiles/common/constants/platform_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion controllers/profiles/common/properties/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, ""))
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 165c705

Please sign in to comment.