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

Yi Yan commented on CAMEL-10340:
--------------------------------

Hi Andrea,

Thank you for your reply! I list the relationship table between 'delete after 
read' and 'if filtered' options by the sqs consumer source code: 
||deleteAfterRead(option)||deleteIfFiltered(option)||Passed by filter||result 
to delete||
|Yes|Yes|Yes/No|Delete|
|Yes|No|Yes|Delete|
|Yes|No|No|Do not delete|
|No|Yes/No|Yes/No|Do not delete|

After that, I added a filter in my route and it works when the deleteAfterRead 
is false, but when I set both deleteAfterRead and deleteIfFiltered to true, all 
the messages have been removed in my queue finally, that means if the 
deleteIfFiltered is true, the message will be always removed whether or not the 
route has filter, is it expected result?

Thanks,
Yi




Here is my code, in this route deleteAfterRead and deleteIfFiltered are both 
true, filtered the message body with 'bar', should it only delete the 'bar' 
message in SQS queue?
{code}
from(
        
"aws-sqs:myQueue?amazonSQSClient=#myClient&deleteAfterRead=true&deleteIfFiltered=true")
        .filter().simple("${body} == 'bar'")
        .to("log:r1.myLog1?level=INFO");

from("timer:myTimer1?repeatCount=2&delay=1000")
        .setBody().constant("foo")
        .to("aws-sqs:myQueue?amazonSQSClient=#myClient");

from("timer:myTimer2?repeatCount=3&delay=1000")
        .setBody().constant("bar")
        .to("aws-sqs:myQueue?amazonSQSClient=#myClient");
{code}

> camel-aws - SQS option deleteAfterRead not work if set deleteIfFiltered=false
> -----------------------------------------------------------------------------
>
>                 Key: CAMEL-10340
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10340
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-aws
>    Affects Versions: 2.17.3
>            Reporter: Yi Yan
>            Priority: Minor
>         Attachments: SqsConsumerDeleteTest.java
>
>
> I'm using aws-sqs 2.17.3, if I set deleteAfterRead=true and 
> deleteIfFiltered=false in my DSL, the message will not be deleted. If I want 
> to delete the message after read it, I have to set deleteAfterRead and 
> deleteIfFiltered both with true when I use the two options in one DSL, but in 
> fact there is no filter in my route, the message should be removed whatever 
> the deleteIfFiltered option set to ture or false.
> {code:title=SqsConsumerDeleteTest.java|borderStyle=solid}
> from("aws-sqs:my-quque"
>     + "?amazonSQSClient=#conn_cAWSConnection_1"
>     + "&deleteAfterRead=" + true + "&deleteIfFiltered="
>     + false).to("log:qs_route.cLog_1" + "?level=DEBUG").to("mock:mock_1");
> {code}
> I attached my test file, after run the test method, the sqs message still 
> exists in the sqs queue after 30 seconds.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to