You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Bernard Ligny (Jira)" <ji...@apache.org> on 2020/11/25 09:16:00 UTC

[jira] [Updated] (CAMEL-15892) CamelJmsDestinationName header ignored (when set in onPrepareFailure)

     [ https://issues.apache.org/jira/browse/CAMEL-15892?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bernard Ligny updated CAMEL-15892:
----------------------------------
    Summary: CamelJmsDestinationName header ignored (when set in onPrepareFailure)  (was: CamelJmsDestinationName header ignored )

> CamelJmsDestinationName header ignored (when set in onPrepareFailure)
> ---------------------------------------------------------------------
>
>                 Key: CAMEL-15892
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15892
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-sjms
>    Affects Versions: 3.6.0
>            Reporter: Bernard Ligny
>            Priority: Major
>
> 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.
> Therefore, I tried this:
> {code:java}
> DefaultErrorHandlerBuilder dlc = deadLetterChannel("jms:queue:dummy")
>             .useOriginalMessage()
>             .maximumRedeliveries(2);                
> dlc.onPrepareFailure( exchange -> {
>      // Override destination                                
>      exchange.getMessage().setHeader("CamelJmsDestinationName", "jms:queue:test");                   
> });
> {code}
> 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:
> {code:java}
> @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;      
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)