You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/01/11 15:48:52 UTC
[camel] branch camel-3.14.x updated: CAMEL-17437: deadLetterChannel should not eager resolve endpoint from uri in Java DSL.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.14.x by this push:
new 70ec033 CAMEL-17437: deadLetterChannel should not eager resolve endpoint from uri in Java DSL.
70ec033 is described below
commit 70ec03315e938708128a6ec6be72de10de01ffa6
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jan 8 11:26:03 2022 +0100
CAMEL-17437: deadLetterChannel should not eager resolve endpoint from uri in Java DSL.
---
.../main/java/org/apache/camel/builder/BuilderSupport.java | 2 +-
.../org/apache/camel/builder/DeadLetterChannelBuilder.java | 2 ++
.../impl/event/EventNotifierFailureHandledEventsTest.java | 4 ++--
...DeadLetterChannelBuilderWithInvalidDeadLetterUriTest.java | 12 ++++++------
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java b/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java
index d6cae2e..91244f0 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/builder/BuilderSupport.java
@@ -431,7 +431,7 @@ public abstract class BuilderSupport implements CamelContextAware {
* @return the builder
*/
public DeadLetterChannelBuilder deadLetterChannel(String deadLetterUri) {
- return deadLetterChannel(endpoint(deadLetterUri));
+ return new DeadLetterChannelBuilder(deadLetterUri);
}
/**
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/builder/DeadLetterChannelBuilder.java b/core/camel-core-model/src/main/java/org/apache/camel/builder/DeadLetterChannelBuilder.java
index 67e49b3..7bc8e03 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/builder/DeadLetterChannelBuilder.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/builder/DeadLetterChannelBuilder.java
@@ -44,6 +44,8 @@ public class DeadLetterChannelBuilder extends DefaultErrorHandlerBuilder impleme
public DeadLetterChannelBuilder(String uri) {
setDeadLetterUri(uri);
+ // DLC do not log exhausted by default
+ getRedeliveryPolicy().setLogExhausted(false);
}
@Override
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/event/EventNotifierFailureHandledEventsTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/event/EventNotifierFailureHandledEventsTest.java
index e1d7b9f..979ce7d 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/event/EventNotifierFailureHandledEventsTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/event/EventNotifierFailureHandledEventsTest.java
@@ -91,7 +91,7 @@ public class EventNotifierFailureHandledEventsTest extends ContextTestSupport {
ExchangeFailureHandlingEvent e0 = assertIsInstanceOf(ExchangeFailureHandlingEvent.class, events.get(11));
assertEquals(true, e0.isDeadLetterChannel(), "should be DLC");
- assertEquals("mock://dead", e0.getDeadLetterUri());
+ assertEquals("mock:dead", e0.getDeadLetterUri());
assertIsInstanceOf(ExchangeSendingEvent.class, events.get(12));
assertIsInstanceOf(ExchangeSentEvent.class, events.get(13));
@@ -106,7 +106,7 @@ public class EventNotifierFailureHandledEventsTest extends ContextTestSupport {
}
SendProcessor send = assertIsInstanceOf(SendProcessor.class, fh);
assertEquals("mock://dead", send.getDestination().getEndpointUri());
- assertEquals("mock://dead", e.getDeadLetterUri());
+ assertEquals("mock:dead", e.getDeadLetterUri());
// dead letter channel will mark the exchange as completed
assertIsInstanceOf(ExchangeCompletedEvent.class, events.get(15));
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelBuilderWithInvalidDeadLetterUriTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelBuilderWithInvalidDeadLetterUriTest.java
index bb0e629..7aa1376 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelBuilderWithInvalidDeadLetterUriTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelBuilderWithInvalidDeadLetterUriTest.java
@@ -37,12 +37,11 @@ public class DeadLetterChannelBuilderWithInvalidDeadLetterUriTest extends Contex
from("direct:start").to("mock:foo");
}
});
+ context.start();
fail("Should have thrown an exception");
- } catch (NoSuchEndpointException e) {
- assertEquals(
- "No endpoint could be found for: xxx, please check your classpath contains the needed Camel component jar.",
- e.getMessage());
+ } catch (Exception e) {
+ assertIsInstanceOf(NoSuchEndpointException.class, e.getCause());
}
}
@@ -57,10 +56,11 @@ public class DeadLetterChannelBuilderWithInvalidDeadLetterUriTest extends Contex
from("direct:start").to("mock:foo");
}
});
+ context.start();
fail("Should have thrown an exception");
- } catch (ResolveEndpointFailedException e) {
- assertTrue(e.getMessage().endsWith("Unknown parameters=[{foo=bar}]"));
+ } catch (Exception e) {
+ assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
}
}