diff --git a/bpdm-cleaning-service-dummy/src/main/kotlin/org/eclipse/tractusx/bpdm/cleaning/service/CleaningServiceDummy.kt b/bpdm-cleaning-service-dummy/src/main/kotlin/org/eclipse/tractusx/bpdm/cleaning/service/CleaningServiceDummy.kt index 0ba318a15..a9d962f59 100644 --- a/bpdm-cleaning-service-dummy/src/main/kotlin/org/eclipse/tractusx/bpdm/cleaning/service/CleaningServiceDummy.kt +++ b/bpdm-cleaning-service-dummy/src/main/kotlin/org/eclipse/tractusx/bpdm/cleaning/service/CleaningServiceDummy.kt @@ -36,14 +36,17 @@ class CleaningServiceDummy( private val logger = KotlinLogging.logger { } - @Scheduled(cron = "\${cleaningService.pollingCron:-}", zone = "UTC") fun pollForCleaningTasks() { + processPollingTasks(TaskStep.CleanAndSync) + processPollingTasks(TaskStep.Clean) + } + + + private fun processPollingTasks(step: TaskStep) { try { - logger.info { "Starting polling for cleaning tasks from Orchestrator..." } - val step = TaskStep.CleanAndSync + logger.info { "Starting polling for cleaning tasks from Orchestrator... TaskStep ${step.name}" } - // Step 1: Fetch and reserve the next cleaning request val cleaningRequest = orchestrationApiClient.goldenRecordTasks .reserveTasksForStep(TaskStepReservationRequest(amount = 10, step)) @@ -53,11 +56,9 @@ class CleaningServiceDummy( if (cleaningTasks.isNotEmpty()) { val cleaningResults = cleaningTasks.map { reservedTask -> - // Step 2: Generate dummy cleaning results processCleaningTask(reservedTask) } - // Step 3: Send the cleaning result back to the Orchestrator orchestrationApiClient.goldenRecordTasks.resolveStepResults(TaskStepResultRequest(step, cleaningResults)) logger.info { "Cleaning tasks processing completed for this iteration." } }