Bluelock / camel-spring-amqp

Spring AMQP Component for Apache Camel
61 stars 54 forks source link

Dead letter error handler not working with spring-amqp queue uri #60

Closed bogdanalbei closed 9 years ago

bogdanalbei commented 9 years ago

Hi, I have the following error handler:

    <bean id="deadLetterErrorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
         <property name="deadLetterUri" value="spring-amqp:MangaHigh:dead:dead?type=direct&amp;autodelete=false&amp;durable=false"/>
         <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
         <property name="useOriginalMessage" value="true"/>
    </bean>

     <bean id="redeliveryPolicyConfig" class="org.apache.camel.processor.RedeliveryPolicy">
         <property name="maximumRedeliveries" value="3"/>
         <property name="redeliveryDelay" value="500"/>
         <property name="useExponentialBackOff" value="true"/>
     </bean>

The dead letter message is published into the exchange, so an additional binding has to exist for the message to get into the right queue. Is this supposed to only publish into exchanges, or should it also support pushing messages directly into the queue?

michaelpage commented 9 years ago

The SpringAMQPConsumer endpoints create queues and bind them as specified in the URI. The dead letter channel endpoint is a SpringAMQPProducer. It uses this URI format: spring-amqp:exchange:routingKey?params=values.

So in your setup the exchange MangaHigh would be created and all messages that pass through the dead letter channel would use a routing key of dead. The last dead token in the URI would be ignored. In this instance you would need to create the dead queue manually (or with some other process) and bind it to the exchange using the dead routing key.

bogdanalbei commented 9 years ago

That's what I did, I created the dead queue and setup the bind manually. I suppose what I want is more of a feature request than a bug. I'll close this. Cheers!