You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2025/09/26 06:09:29 UTC

(camel-quarkus) branch main updated: Add retry logic for debezium-oracle container startup #7773

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new ae94fd3ba9 Add retry logic for debezium-oracle container startup #7773
ae94fd3ba9 is described below

commit ae94fd3ba9838df8f3120c74f2f14c4067e11874
Author: James Netherton <ja...@users.noreply.github.com>
AuthorDate: Fri Sep 26 07:09:24 2025 +0100

    Add retry logic for debezium-oracle container startup #7773
---
 .../it/postgres/DebeziumOracleTestResource.java    | 39 ++++++++++++++--------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/integration-test-groups/debezium/oracle/src/test/java/org/apache/camel/quarkus/component/debezium/common/it/postgres/DebeziumOracleTestResource.java b/integration-test-groups/debezium/oracle/src/test/java/org/apache/camel/quarkus/component/debezium/common/it/postgres/DebeziumOracleTestResource.java
index 7aac9edb68..eb0032ebdd 100644
--- a/integration-test-groups/debezium/oracle/src/test/java/org/apache/camel/quarkus/component/debezium/common/it/postgres/DebeziumOracleTestResource.java
+++ b/integration-test-groups/debezium/oracle/src/test/java/org/apache/camel/quarkus/component/debezium/common/it/postgres/DebeziumOracleTestResource.java
@@ -63,22 +63,35 @@ public class DebeziumOracleTestResource extends AbstractDebeziumTestResource<Gen
     @Override
     public Map<String, String> start() {
         Map<String, String> properties;
-        try {
-            properties = super.start();
-        } catch (Exception e) {
-            LOG.warn(e.getMessage());
-            throw e;
-        }
 
-        try {
-            historyFile = Files.createTempFile(getClass().getSimpleName() + "-history-file-", "");
-
-            properties.put(DebeziumOracleResource.PROPERTY_DB_HISTORY_FILE, historyFile.toString());
-        } catch (IOException e) {
-            throw new RuntimeException(e);
+        // TODO: Remove retry logic - https://github.com/apache/camel-quarkus/issues/7773
+        int maxRetries = 5;
+        for (int i = 1; i <= maxRetries; i++) {
+            try {
+                LOG.info("Starting {} attempt {} of {}", ORACLE_IMAGE, i, maxRetries);
+                properties = super.start();
+                historyFile = Files.createTempFile(getClass().getSimpleName() + "-history-file-", "");
+                properties.put(DebeziumOracleResource.PROPERTY_DB_HISTORY_FILE, historyFile.toString());
+                return properties;
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            } catch (Exception e) {
+                LOG.warn("Container startup failed", e);
+                LOG.warn(e.getMessage());
+                if (i == maxRetries) {
+                    LOG.warn("Giving up starting {} - max container startup attempts reached", ORACLE_IMAGE);
+                    throw e;
+                }
+
+                try {
+                    Thread.sleep(5000);
+                } catch (InterruptedException ex) {
+                    Thread.currentThread().interrupt();
+                }
+            }
         }
 
-        return properties;
+        throw new IllegalStateException("Could not start container for " + ORACLE_IMAGE);
     }
 
     @Override