Federico Mariani created CAMEL-27015:
----------------------------------------

             Summary: camel-aws2-s3, camel-azure-storage-blob, camel-aws2-sqs - 
the consumers delete or move the object named by the headers as the route left 
them, not the one they consumed
                 Key: CAMEL-27015
                 URL: https://issues.apache.org/jira/browse/CAMEL-27015
             Project: Camel
          Issue Type: Bug
          Components: camel-aws2, camel-azure
            Reporter: Federico Mariani


With {{deleteAfterRead}} or {{moveAfterRead}}, three consumers take what to 
delete or move from the message headers when the exchange completes, not from 
what they consumed:
* aws2-s3: the {{CamelAwsS3Key}} header, and {{CamelAwsS3BucketName}} as the 
source of the copy of a move.
* azure-storage-blob: the {{CamelAzureStorageBlobBlobName}} header.
* aws2-sqs: the {{CamelAwsSqsReceiptHandle}} header.

A route that sets these headers, for example to write a copy of the object 
under another name (the S3 and blob producers take the name from the same 
header), deletes or moves its copy. The consumed object stays, and the next 
poll consumes it again.

A route that removes the Camel headers, or replaces the message, leaves the 
object or message in place too:
* aws2-s3: the delete fails in the client on the null key 
({{SdkClientException}}). {{processCommit}} only catches 
{{AwsServiceException}}, so the failure does not reach the exception handler of 
the consumer.
* azure-storage-blob: the consumer logs a WARN and does nothing.
* aws2-sqs: the consumer sends a {{DeleteMessage}} without a receipt handle. 
The message comes back after its visibility timeout, every time.

{code:java}
from("aws2-s3://bucket?prefix=inbox/")
    .setHeader(AWS2S3Constants.KEY, simple("done/${header.CamelAwsS3Key}"))
    .to("aws2-s3://bucket"); // deletes done/inbox/a.txt, inbox/a.txt is 
consumed again

from("azure-storage-blob://account/container?prefix=inbox/&deleteAfterRead=true")
    .setHeader(BlobConstants.BLOB_NAME, 
simple("done/${header.CamelAzureStorageBlobBlobName}"))
    .to("azure-storage-blob://account/container?operation=uploadBlockBlob"); // 
the same

from("aws2-sqs://queue")
    .removeHeaders("*")
    .to("http://backend";); // the message is never deleted
{code}

Expected: the consumer deletes or moves the object or message it consumed, as 
CAMEL-25945 does for azure-storage-queue. It takes the key, the blob name or 
the receipt handle when it consumes the message, before the route runs, and the 
bucket or container of the endpoint.

_Claude Code on behalf of Federico Mariani_



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

Reply via email to