Created
February 10, 2016 20:54
-
-
Save coopernurse/e73907957a95ac00b840 to your computer and use it in GitHub Desktop.
test of non-ascii sqs handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestQueue { | |
public static void main(String argv[]) throws Exception { | |
Log4JInit.init(); | |
AWSCredentials creds = new EnvironmentVariableCredentialsProvider().getCredentials(); | |
AmazonSQS sqs = new AmazonSQSClient(creds).withRegion(Regions.US_WEST_2); | |
String queueUrl = sqs.getQueueUrl("jamescuser_sync").getQueueUrl(); | |
String test = "Lorem ipsum是指一篇用于网页设计、排印、布局和印刷的伪拉丁文章,其用于代替英语去强调设计元素而不是内容。它也被称为占位符文(或填充文)。它是一个很便利的模板工具。它用于帮助编排文章或演示文稿的视觉元素,如排印,字体,或布局。Lorem ipsum 大多是由古典作家和哲学家西塞罗创作的拉丁文的一部分。它的单词和字母由于添加或去移除而被改变了,所以故意使其内容荒谬;它不是真实的,正确的,再也不是可理解的拉丁语。虽然lorem ipsum看起来仍像古典拉丁语,但实际上它没有任何意义。因为西塞罗的文本不包含K"; | |
sqs.sendMessage(new SendMessageRequest(queueUrl, test)); | |
Thread.sleep(2000); | |
ReceiveMessageResult result = sqs.receiveMessage(queueUrl); | |
for (Message msg : result.getMessages()) { | |
System.out.println("---------------------"); | |
String body = msg.getBody(); | |
System.out.println(body); | |
System.out.println("---------------------"); | |
if (!body.equals(test)) { | |
throw new Exception("body != test"); | |
} | |
sqs.deleteMessage(new DeleteMessageRequest(queueUrl, msg.getReceiptHandle())); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment