delete doesn't work

k2xl avatark2xl created an issue

Great project, but the delete functionality doesn't seem to work (Also doesn't work in the AWSAdmin tool)

The messages just keep coming back... I know there are rare exceptions on amazon when it can send the same message, but it really just doesn't delete the messages ever...

Comments (8)

  1. Kresimir Popovic

    Hello,

    thank you for reporting. I will check delete message action.

    One thing to mention: For successful message delete latest recipient handle must be used. Recipient handle is recreated each time when someone fetches a message.

    Scenario sample (AWSAdmin tool):

    1. List messages in "Receive message table"

    2. Choose message to delete (if someone fetched this message after you then your recipient handle is not valid any more)

    Best Regards,

    Krešimir

  2. Kresimir Popovic

    Hello, I have found a bug in deleteMessage action. I will fix it. I plan to release a new SDK version in few days. Is this OK for you ?

    Questioner:

    a) Do you like Flex SDK implementation ? Is it simple to use from developer perspective ?

    b) Is Wiki enough detailed how to use API ?

    c) I'm currently working on implementation of CloudWatch service to be part of SDK so that users can check AWS/SQS metrics and statistics.

    Best Regards,

    Krešimir

  3. k2xl

    a) it is good if i were using flex, but i'm using flash cs 5.5, so i had to do a bunch of workarounds (like importimg flex sdk mx library) in order for it to work. but i got it working for now. b) would be great if wiki could provide code examples. i had to look at the source of your air appp to ensure i was calling delete message properly. also it too me a looking at your air app to realize that i didnt need to parse the xml response myself- so code example of that would be great. i love it when wiki's have code examples for specific tasks. c) sounds cool

    as for the library itself, passing in function callbacks is nice, but a little bit unusual compared to other libraries. most have you add an event listener and then the library dispatches events. i don't mind this approach though, but i hope you ensure you delete/clean up the listeners you have ib your library when appropriate. I built an EventManager class (search EventManager as3, my site is k2xl one) you might want to consider using as a replacement for your addevent listener calls in your library to ensure the listeners are deleted.

    also, i would advise removing trace actions for deployment! if i want to see output i could check the raw date.

    thanks for quick response. if you could commit a fix as soon as possible for deleteMessage that would be super helpful for the project i'm working on!

  4. Kresimir Popovic

    Hello,

    wiki samples: https://bitbucket.org/Kresimir/as3awssdk/wiki/Home (see "as3awsSDK SQS supported actions". You have 11 links named by every action). sample for deleteMessage action: https://bitbucket.org/Kresimir/as3awssdk/wiki/DeleteMessage

    -------

    Regarding function callbacks...I wanted to spare developer for manually define type of event and to work out-of-box. I could add function "removeEventListeners()". It could look like this:

    var client: AmazonSQSClient = null;
    
    /**
    * Function executes delete message.
    */
    public function deleteMessage(): void {
       var awsCredentials: BasicAWSCredentials = new BasicAWSCredentials("your access key id", "your secret key");
       var clientConfig: ClientConfiguration = new ClientConfiguration();
       clientConfig.endpoint = "sqs.eu-west-1.amazonaws.com"; (mandatory parameter)
       clientConfig.protocol = ProtocolEnum.HTTPS; (optional parameter)
       clientConfig.signatureExpires = 60; // signature expires after 60 seconds (optional parameter)
       clientConfig.userAgent = "Amazon SQS service tool 1.0.0"; (optional parameter - only for AIR Runtime)
       
       client = new AmazonSQSClient(awsCredentials, clientConfig);
       var request:DeleteMessageRequest = new DeleteMessageRequest();
       
       // 123456789012 - your account id. It is optional.
       request.setQueueUrl("https://sqs.eu-west-1.amazonaws.com/123456789012/TestQueue"); // mandatory parameter
       //request.setQueueUrl("https://sqs.eu-west-1.amazonaws.com/TestQueue"); //  mandatory parameter
       request.setReceiptHandle("MbZj6wDWli+JvwwJaBV+3dcjk2YW2vA3+STFFljTM8tJJg6HRG6PYSasuWXPJB+Cw
                                 Lj1FjgXUv1uSj1gUPAWV66FU/WeR4mq2OKpEGYWbnLmpRCJVAyeMjeU5ZBdtcQ+QE
                                 auMZc8ZRv37sIW2iJKq3M9MFx1YvV11A2x/KSbkJ0="); // mandatory parameter
    
        client.deleteMessage(request, resultHandler, faultHandler);  // event listeners are created automatically!        
    }
    
    /**
    * Asynchronous positive response.
    */
    private function resultHandler(event: CompleteActionEvent): void {
       client.removeEventListeners(); // shutdown all listeners!
       var result: DeleteMessageResult = event.result as DeleteMessageResult;
       var requestId: String = result.getRequestId();
    }
    
    
    /**
    * Asynchronous negative response.
    */
    private function faultHandler(event: IOErrorActionEvent): void {
       client.removeEventListeners(); // shutdown all listeners!
       var result: AmazonWebServiceErrorResult = event.result as AmazonWebServiceErrorResult;
       var type: String = result.getType();
       var code: String = result.getCode();
       var message: String = result.getMessage();
       var detail: String = result.getDetail();  
    }
        
    

    -------

    I agree that trace("....") should be removed.

    -------

    I'm interested to know for what purpose do you use this Flex library? In practice...

    -------

    Try unofficial correction from attach.

    Best Regards, Krešimir

  5. k2xl

    attachment works! messages are now being deleted and thanks for putting code samples in wiki!

    now if you could just get those trace actions out :-).

  6. Kresimir Popovic

    Hello, I'm glad that you are satisfied with the correction.

    I will soon release official correction release 1.4.

    - All traces will be removed from library.

    - removeEventListeners() method will be added to SQS and CloudWatch interface

    - Wiki will be updated

    - new ASDOC will be generated

    - Adobe AIR SQS Administration tool will be updated to version 1.0.2 (will use SDK library 1.4)

    ps. I'm interested to know for what purpose do you use this Flex library? In practice...if it is not a secret :-)

    Best Regards,

    Krešimir

  7. k2xl

    Hey Kresimir, We're using it for our startup project (IPhone app).

    Thanks for the updates! We'll continue to let you know if we find any more bugs.

  8. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.