- Create SQS Client CodeGet the wsdl located at http://queue.amazonaws.com/doc/2009-02-01/QueueService.wsdl
Generate code from wsdltojava tool. See following figure
Unzip given zip file from wsdl to java tool and open it with some IDE(eclipse or idea). Use following command to create idea projectmvn idea:idea
Build project with maven using the commandmvn clean install
Then we have to add necessary jars to class pathFirst run ant command inside your message broker product as followspacks/wso2mb-1.0.2/bin$ antThen this will copy jars to repository/lib folder inside your pack. We have to add those jars to class path of created project(Eclipse or idea)
Then build your project using ide. If it complaints about axiom or rampart jars please remove them from the class path(remove any axiom jars except version 1.2.11.wso2v1)
Then add SQSClient java code to project. We must run the main method in this class in order to run the SQS operations. Code is available at following url http://wso2.org/project/message-broker/1.0.2/docs/samples/sqs_soap_client.htmlChange the "accessKey" and the "secretAccessKey" in sqsClient.java code to the keys which can be found at "Home > Manage> Message Boxes(SQS)> Access Keys" of wso2mb server
- Run sqsClient java code and you will see following output in terminalcreateQueueResponse.getCreateQueueResult().getQueueUrl() = http://localhost:9763/services/MessageQueue/admin/SharedcreateQueueResponse.getCreateQueueResult().getQueueUrl() = http://localhost:9763/services/MessageQueue/admin/Sharedmessage_type0.getBody() = TEST MESSAGEmessage_type0.getBody() = TEST MESSAGEmessage_type0.getBody() = TEST MESSAGEmessage_type0.getBody() = TEST MESSAGEmessage_type0.getBody() = TEST MESSAGEmessage_type0.getBody() = TEST MESSAGEmessage_type0.getBody() = TEST MESSAGEmessage_type0.getBody() = TEST MESSAGEmessage_type0.getBody() = TEST MESSAGEmessage_type0.getBody() = TEST MESSAGEcreateQueueResponse.getCreateQueueResult().getQueueUrl() = http://localhost:9763/services/MessageQueue/admin/SharedcreateQueueResponse.getCreateQueueResult().getQueueUrl() = http://localhost:9763/services/MessageQueue/admin/Shared
No comments:
Post a Comment