dimanche 31 mai 2015

Amazon SQS Error: InvalidParameterValue

I've got a problem with Amazon SQS in combination with Eclipse. When I run this method:

    public void askForPayment(int userId, double amount){
    SendMessageRequest request = new SendMessageRequest(shopToCreditCardTerminalURL, "");
    request.addMessageAttributesEntry("type",new MessageAttributeValue().withStringValue("@AskForPayment"));
    request.addMessageAttributesEntry("userID", new MessageAttributeValue().withStringValue(Integer.toString(userId)));
    System.out.println(Double.toString(amount));
    request.addMessageAttributesEntry("amount", new MessageAttributeValue().withStringValue(Double.toString(amount)));
    sqs.sendMessage(request);
}

I get the following error:

Exception in thread "main" com.amazonaws.AmazonServiceException: The message attribute 'amount' must contain non-empty message attribute type. (Service: AmazonSQS; Status Code: 400; Error Code: InvalidParameterValue; Request ID: 69ee2891-1a47-5511-982f-6575ebc8a1ed)
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1160)
at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:748)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:467)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:302)
at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2422)
at com.amazonaws.services.sqs.AmazonSQSClient.sendMessage(AmazonSQSClient.java:1015)
at de.patrick.onlineshop.Onlineshop.test(Onlineshop.java:271)
at de.patrick.onlineshop.Onlineshop.main(Onlineshop.java:63)

I don't get the point of the problem? Does anybody know anything?

:)




1 commentaire: