简体   繁体   中英

Understanding Apache Camel routing for Amazon SQS

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM