0

I have an SQS queue. The objective that I am looking to accomplish is to filter message based upon message attributes and delete the same if it matches the filter criteria. So I have a function in Java which looks something like this

public String getUri(){
    String uri = String.format("aws-sqs://%s?accessKey=%s&secretKey=%s&attributeNames=test&deleteIfFiltered=true",queueUrl,key,secret)
    return uri;
}

Post this I am calling this function

public Builder extends RouteBuilder{

    @Override
    public void configure(){
        try{
            from(getUri())
            .setHeader()
            ...
        }

    }

It looks like the route that is building is not able to delete the message.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Rakshith
  • 644
  • 1
  • 8
  • 24

1 Answers1

1

You need to do as in the documentation says: https://camel.apache.org/components/latest/aws2-sqs-component.html

about the deleteIfFiltered option.

You need to set the exchange property (not header) with key CamelAwsSqsDeleteFiltered to true.

See the docs and this example: https://camel.apache.org/components/latest/aws2-sqs-component.html#_jms_style_selectors

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65