dimanche 31 mai 2015

Amazon SQS Get Message Attributes

it try to fetch some attributes from an Amazon SQS message.

I use the following snippet in Java (Eclipse with the Amazon SDK):

{...
        while(timer<2){
    //Receive new messages from all input Queues
    ReceiveMessageRequest receiveMessageRequestCreditCardTerminal = new ReceiveMessageRequest(creditCardTerminalToShopURL);
    ReceiveMessageRequest receiveMessageRequestShipping = new ReceiveMessageRequest(shippingToShopURL);
    ReceiveMessageRequest receiveMessageRequestSuggestion = new ReceiveMessageRequest(suggestionServerToShopURL);
    requestList.add(receiveMessageRequestCreditCardTerminal);
    requestList.add(receiveMessageRequestShipping);
    requestList.add(receiveMessageRequestSuggestion);
    System.out.println("Reached run method and in while loop");

    for(ReceiveMessageRequest r : requestList){ 
    System.out.println("Reched for loop with r");
    List<Message> messagesList = sqs.receiveMessage(r.withMessageAttributeNames("All")).getMessages();  
        for(Message m : messagesList){
            System.out.println("Reached run method and in for loop with message");
            System.out.println("Message: "+m.getMessageId());
            System.out.println("Attributes: "+m.getAttributes());
...}
}

But the Attributes System out returns an empty Array... what can I do, I'm really desperate -.-'




Aucun commentaire:

Enregistrer un commentaire