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

Michael Weiss commented on CAMEL-23032:
---------------------------------------

In my tests I have set maxDeliver and a non-linear redelivery behaviour 
(backoff)  with a Bean and referenced it via "consumerConfiguration" parameter. 
After maxDeliver it is getting deadlettered which is the desired behaviour (in 
my case).

This was recommended in 
https://streamtrace.io/articles/nats-jetstream-dead-letter-queue-implementation/

 
{color:#cccccc}- {color}{color:#569cd6}beans{color}{color:#cccccc}:{color}
{color:#cccccc} - {color}{color:#569cd6}name{color}{color:#cccccc}: 
{color}{color:#ce9178}natsConfig{color}
{color:#cccccc} {color}{color:#569cd6}script{color}{color:#cccccc}: 
{color}{color:#c586c0}|{color}
{color:#ce9178} io.nats.client.api.ConsumerConfiguration.builder(){color}
{color:#ce9178} .maxDeliver(5){color}
{color:#ce9178} .backoff(1000, 5000, 60000, 300000, 600000){color}
{color:#ce9178} .build(){color}
{color:#cccccc} {color}{color:#569cd6}scriptLanguage{color}{color:#cccccc}: 
{color}{color:#ce9178}groovy{color}
{color:#cccccc} {color}{color:#569cd6}type{color}{color:#cccccc}: 
{color}{color:#ce9178}io.nats.client.api.ConsumerConfiguration{color}

> camel-nats consumer sends ACK regardless of the Exchange processing/delivery 
> result
> -----------------------------------------------------------------------------------
>
>                 Key: CAMEL-23032
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23032
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-nats
>    Affects Versions: 4.17.0, 4.18.0
>            Reporter: Michael Weiss
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.18.1, 4.19.0
>
>
> h3. Expected behaviour
> NATS consumer only acknowledges message that are successfully routed to the 
> producer, so they can be redelivered in case of an error. This is the 
> behaviour seen on other Message Queue Consumers like RabbitMQ.
> h3. Tested behaviour
> NATS consumer acknowledges any messages, regardless of if the Exchange 
> processing fails or suceeds
> h3. Impact
> Messages are lost and cannot be redelivered
> h3. Example
> Test route with a built in error. Consumer sends ACK even when the Exchange 
> fails:
> {code:yaml}
> - route:
>     id: route-3401
>     from:
>       id: from-2566
>       uri: nats
>       parameters:
>         jetstreamEnabled: true
>         jetstreamName: test
>         durableName: camel
>         exchangePattern: InOut     # Tested with InOnly as well
>         pullSubscription: false
>         servers: nats:4222
>         topic: "456"
>       steps:
>         - log:
>             id: log-2580
>             message: ${body}
>         - setBody:
>             disabled: false
>             groovy:
>               expression: |
>                 1/0
>         - to:
>             uri: log:logger
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to