Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Information Provided
-
3.6.0
-
None
-
None
-
Unknown
Description
I'm trying to setup a smart JMS DeadLetterChannel where the final uri of the DLQ is computed dynamically, depending on original queue name (eg adding a ".dead" suffix).
I have seen in the doc that it's possible by setting the CamelJmsDestinationName header:
https://camel.apache.org/components/latest/jms-component.html#_reuse_endpoint_and_send_to_different_destinations_computed_at_runtime
Therefore, I tried this:
DefaultErrorHandlerBuilder dlc = deadLetterChannel("jms:queue:dummy") .useOriginalMessage() .maximumRedeliveries(2); dlc.onPrepareFailure( exchange -> { // Override destination exchange.getMessage().setHeader("CamelJmsDestinationName", "jms:queue:test"); });
I have tried many different values for CamelJmsDestinationName :
- "jms:queue:test"
- "queue:test"
- "test"
But none of them is working; the header is ignored and the exchange always goes to original uri ("queue:dummy").
I'm using Camel 3.6 and camel-sjms2 component bound to an Artemis ActiveMQ broker (the one bundled with Wildfly20):
@Resource(mappedName = "java:/ConnectionFactory") private static ConnectionFactory connectionFactory; @Produces @ApplicationScoped @Named("jms") public final Sjms2Component createJmsComponent() { Sjms2Component component = new Sjms2Component(); ConnectionResource pool = new ConnectionFactoryResource(poolSize, connectionFactory); component.setConnectionResource(pool); return component; }