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

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

commit 9476294d66a711afd874e60623f5816c7f39c692
Author: James Netherton <[email protected]>
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

Reply via email to