Wednesday, February 29, 2012

How to trace inside the clone mediator and enable statistics and tracing for dynamic sequences

Trace inside the clone mediator and  enable statistics and tracing for dynamic sequences in WSO2 ESB

Here in this article i will try to brefly describe how to use WSO2 ESB samples and how to trace inside clone mediator.

You can download WSO2 ESB from here
http://wso2.com/products/enterprise-service-bus/

Starting the WSO2 ESB
Goto /bin folder run following command for ubuntu
> sh wso2server.sh
Run with sample here 0 is sample number
>sh wso2esb-samples.sh -sn 0

Log in to ESB as admin and
Goto Home> Configure > Logging > Service Bus Configuration by Clicking on source view. Then you will see synapse configuration source view.
Add following sequence to esb Configuration.


<sequence name="main" trace="enable" statistics="enable">
        <in>
            <clone>
                <target>
                    <sequence>
                        <log/>
                        <property name="a" value="a" scope="default"/>
                        <drop/>
                    </sequence>
                </target>
                <target>
                    <sequence>
                        <log/>
                        <property name="b" value="B" scope="default"/>
                        <drop/>
                    </sequence>
                </target>
            </clone>
        </in>
        <out>
            <send/>
        </out>
    </sequence>


As you can see here this will enable logs inside clone mediator. This will clone message and then add property a and b then drop the message.

Starting the Sample Apache Axis2 Server
Here we are using a standalone Apache Axis2 Web services engine(bundled with your ESB distribution) as the server
user@host:~/wso2esb/samples/axis2Server/src/SimpleStockQuoteService$ ant

now We have to start axis2server. Goto directory wso2esb-3.0.1/samples/axis2Server and type following command
wso2esb-3.0.1/samples/axis2Server$ sh axis2server.sh

To run sample client and send request to server goto folder wso2esb-3.0.1/samples/axis2Client and type following command
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/

When you goto logs you will find logs related to 2 sequences inside clone mediator.See following logs
2012-02-29 14:43:12,029 [-] [HttpServerWorker-17] DEBUG Axis2SynapseEnvironment Injecting MessageContext for asynchronous mediation using the : Anonymous Sequence
2012-02-29 14:43:12,029 [-] [SynapseWorker-9] DEBUG PropertyMediator Setting property : a at scope : default to : a (i.e. constant : a)
2012-02-29 14:43:12,029 [-] [SynapseWorker-9] DEBUG PropertyMediator End : Property mediator
2012-02-29 14:43:12,030 [-] [SynapseWorker-10] DEBUG SequenceMediator Start : Sequence
2012-02-29 14:43:12,030 [-] [SynapseWorker-9] DEBUG DropMediator Start : Drop mediator
2012-02-29 14:43:12,030 [-] [SynapseWorker-9] DEBUG DropMediator End : Drop mediator
2012-02-29 14:43:12,030 [-] [HttpServerWorker-17] DEBUG CloneMediator End : Clone mediator
2012-02-29 14:43:12,030 [-] [SynapseWorker-9] DEBUG SequenceMediator End : Sequence
2012-02-29 14:43:12,030 [-] [SynapseWorker-10] DEBUG SequenceMediator Sequence :: mediate()



1 comment: