Closed AveryRegier closed 9 years ago
I solved my own problem. I was sending 'All' as a message attribute instead of just as a plain old attribute. Sorry for the spam.
No problem, I'm not 100% sure what was the root cause, but anyway if there's something that ElasticMQ should set (and what SQS sets) that would be useful for tests let me know, it should be added :)
I am using ElasticMQ to test a monitoring tool for SQS. The intent of the tool is to look at the age of the oldest items in the queue (or at least the first ones found by SQS) and alert if those messages are beyond a certain age.
ElasticMQ doesn't set this attribute (or any others that SQS may set) when messages are added to a queue. I have been able to work around it by adding a String attribute called SentTimestamp myself, however I'm unsure at this point how SQS itself will respond to that, especially since I think this should be a Number data type. When I try to add SentTimestamp with a Number data type as follows, I get this error:
[Fatal Error] :1:1: Content is not allowed in prolog. [Fatal Error] :1:1: Content is not allowed in prolog. [Fatal Error] :1:1: Content is not allowed in prolog. [Fatal Error] :1:1: Content is not allowed in prolog.
com.amazonaws.AmazonServiceException: Unable to unmarshall error response (There was an internal server error.) (Service: AmazonSQS; Status Code: 500; Error Code: 500 Internal Server Error; Request ID: null) at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1073) at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:721) at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:456) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:295) at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2291) at com.amazonaws.services.sqs.AmazonSQSClient.sendMessage(AmazonSQSClient.java:908) Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog. at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:246) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124) at com.amazonaws.util.XpathUtils.documentFrom(XpathUtils.java:125) at com.amazonaws.util.XpathUtils.documentFrom(XpathUtils.java:132) at com.amazonaws.http.DefaultErrorResponseHandler.handle(DefaultErrorResponseHandler.java:80) at com.amazonaws.http.DefaultErrorResponseHandler.handle(DefaultErrorResponseHandler.java:40) at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1041) ... 32 more