Wednesday, February 8, 2012

SQS Client for Stratos Live

It is a great advantage , if we can test message box feature of wso2 message broker in stratos live environment since it takes some time to set up product locally and test. Here i am going to describe how we can use a java client to invoke message box feature which acts as a message store of Wso2 Message broker in stratos live environment.

We can find the sample on creating "SQS SOAP Client" in here. This sample is specifically written for standalone product testing.

For stratos testing there are only few things need to be changed in this sample.

As described in the above sample as the first step you need to generate the code for the SQS wsdl.

For that you have multiple ways,
1. Use Axis2 wsdl2java tool for code generation
You can find samples on how to do that here.

2. Use wsdl2java feature of any of the wso2 products and generate the code from that.

Once you generate the code with using one of the above two methods, you can create a project using those source files.

If it is not automatically added the required libraries to the class path of your project, you need to add the libraries to the class path.

You can find all the required libraries for this source code in Message Broker product.
what you need to do is;

1. Extract
2. go to wso2mb-1.0.2/bin folder and run "ant" command
3. This will create a lib folder in "wso2mb-1.0.2/repository/" folder
4. You can add this lib folder to your class path

Once you have created the project successfully, you can use the same client for invoking Stratos Live Message Broker. How ever before invoking the client, you need to do some changes in that client code.

You need to change following constant of that client;
Eg: For the tenant , EPR will be

public static final String EPR = "";

Apart from that you need to get the "accessKey" and the "secretAccessKey" after log in to the Message Broker service.

With changing those constants , you will be able to use the message box feature of Stratos Message Broker Service successfully.

No comments:

Post a Comment