[ 
https://issues.apache.org/jira/browse/CAMEL-27981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18153830#comment-18153830
 ] 

Guillaume Nodet commented on CAMEL-27981:
-----------------------------------------

This issue is being investigated by a coding agent (on behalf of gnodet).

Root cause confirmed: AggregateProcessor.RecoverTask.run() (line 2062-2075) 
calls deadLetterProducerTemplate.send() when maximumRedeliveries is exceeded, 
but deadLetterProducerTemplate is only initialized when deadLetterUri is set. 
With a recoverable repository (e.g. CaffeineAggregationRepository) using 
default maximumRedeliveries=3 but no deadLetterUri, the template is null, 
causing NPE. The NPE is caught, the exchange is never confirmed, and it loops 
forever.

_Note: This comment was generated by an AI coding agent and requires manual 
verification._

> camel-core - aggregator recovery fails with a NullPointerException when 
> maximumRedeliveries is set without deadLetterUri
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27981
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27981
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: 4.25.0
>
>
> h4. 1. AggregateProcessor.RecoverTask.run (camel-core-processor)
> When a recoverable aggregation repository has maximumRedeliveries > 0 and no 
> deadLetterUri, the exhausted branch calls 
> deadLetterProducerTemplate.send(...), but that template is only created when 
> deadLetterUri is set, so it is null. The NullPointerException is caught, and 
> every recovery scan logs "Failed to move recovered Exchange to dead letter 
> channel: null". The exchange is never sent again and never confirmed, so it 
> stays in the repository for ever.
> This is the default setup of the Caffeine, Ehcache, Hazelcast, Infinispan and 
> Redis aggregation repositories, which default to maximumRedeliveries=3.
> Proposed change: take the exhausted branch only when a deadLetterUri is 
> configured (else keep redelivering, or log and confirm), or fail at start 
> when maximumRedeliveries > 0 has no deadLetterUri.
> Found while checking the option and console descriptions of CAMEL-27980.
> ----
> _Filed by Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to