|
Resources
Sample Code and Libraries
Java Library for Amazon SQS
 |
Java Library for Amazon SQS
| Submitted By: |
Elena@AWS
|
| AWS Products Used: |
Amazon SQS |
| Language(s): |
Java |
| License: |
Apache License 2.0 |
|
|
 |
About this Library
- Based on the 2009-02-01 API version.
What's New?
- 2009-04-14:
- Fixed issue of invalid signature when queue name specified in mixed letter case
- 2009-04-08:
- Support for access control API
- 2009-01-29:
- Fix signature version 2 path encoding
- 2009-01-05:
- Url encoding fix (bug affected signature version 2 with values containing forward slash "/")
- 2008-12-17:
- Support for signature version 2, https endpoint
- 2008-02-29:
Prerequisites
Reference Documentation
Package Content
| Directory |
Overview |
|
lib
|
Binary distribution of library
|
|
src
|
Source distribution of library.
|
|
third-party
|
Binary distribution of library dependencies.
|
Quick Start
Library comes with code samples for each available service API.
To get started with the library, follow these steps:
- Extract the amazon-queue-2009-02-01-java-library.zip file into a working directory.
- Add all sources under "src" directory to your compilation path.
- Add all jars files under "third-party/*" directory to your classpath
- Edit desired sample. For example: CreateQueueSample.java
- Set AWS Access Key ID and AWS Secret Access Key
String accessKeyId = "Your Access Key ID";
String secretAccessKey = "Your Secret Access Key";
- Set request parameters. For example, find following pre-generated snippet:
CreateQueueRequest request = new CreateQueueRequest();
// @TODO: set request parameters here
// invokeCreateQueue(service, request);
- And uncomment third line and add queue name to request:
CreateQueueRequest request = new CreateQueueRequest();
request.setQueueName("MyQueue");
invokeCreateQueue(service, request);
- Compile and run CreateQueue. You should see the output
similar to the following:
CreateQueueResponse
CreateQueueResult
QueueUrl
http://queue.amazonaws.com/MyQueue
ResponseMetadata
RequestId
95cdcb68-f46c-400b-8265-8c2de2a5c475
Note, you may also see additional debugging output. To adjust level of debugging, modify log4j.properties available in the root of the source tree.
- Experiment with samples. When ready, add library binary distribution to your application classpath, and use it.
Happy coding!
Comments, Questions or Feedback
If you have any comments, questions or feedback on the library, please visit the Amazon Simple Queue Service discussion forums.
|
Posts:
1
Registered:
6/11/08
|
|
|
|
Java Library for Amazon SQS
Posted:
Jun 11, 2008 1:40 PM PDT
|
|
|
The contents box lists a "lib" directory, yet no such directory exists in the distribution I downloaded on 2008-06-11. While working with source code is not hugely problematic, a cleaner distribution would make the Java bindings to SQS look a bit more fully baked.
|
|
Posts:
2,715
Registered:
5/25/06
|
|
|
|
Re: Java Library for Amazon SQS
Posted:
Jun 11, 2008 6:31 PM PDT
in response to: Mark Rebuck
|
|
|
I think the AWS client code requires you to grab the dependencies yourself (as do a lot of them out there). I'll shamelessly plug my own SQS client, which turns out to handle quite a bit of the overall SQS traffic!
http://code.google.com/p/typica/ There are just 4 dependencies, less if you use Java 6 (which has JAXB built in).
David
|
|
Posts:
155
Registered:
2/9/06
|
|
|
Posts:
2
Registered:
7/28/08
|
|
|
|
Re: Java Library for Amazon SQS
Posted:
Jul 28, 2008 11:22 AM PDT
in response to: Mark Rebuck
|
|
|
I have not yet created a queue. When I run a ListQueues request, I get back what appears to be well-formed XML with an empty <ListQueuesResult>. This looks right. However, the unmarshal call throws an exception:
javax.xml.bind.UnmarshalException: unexpected element (uri:"
http://queue.amazonaws.com/doc/2008-01-01/", local:"ListQueuesResponse"). Expected elements are <{}Attribute>,<{}CreateQueue>,<{}CreateQueueResponse>,<{}CreateQueueResult>,
<{}DeleteMessage>,<{}DeleteMessageResponse>,<{}DeleteQueue>,
<{}DeleteQueueResponse>,<{}Error>,<{}ErrorResponse>,<{}GetQueueAttributes>,
<{}GetQueueAttributesResponse>,<{}GetQueueAttributesResult>,<{}ListQueues>,
<{}ListQueuesResponse>,<{}ListQueuesResult>,<{}Message>,
<{}ReceiveMessage>,<{}ReceiveMessageResponse>,
<{}ReceiveMessageResult>,<{}ResponseMetadata>,<{}SendMessage>,
<{}SendMessageResponse>,<{}SendMessageResult>,
<{}SetQueueAttributes>,<{}SetQueueAttributesResponse>
Thoughts?
|
|
|
|
jar, Aug 8, 2008 9:25 AM
Reviewer: zernoveanu
It would be nice to have an easy way to download the amazon-queue-2008-01-01-java-library.zip file
|
|
Solve my problem that i had with typica, Feb 5, 2010 7:03 AM
Reviewer: ys276
Got problem with messages from php to java with typica.
It works fine with this lib.
|
|
|
|
 |
|
|