Month: November 2014

Local Transport in WSO2 ESB

Introduction

WSO2 ESB [1] is considered as the fastest 100% open-source enterprise service bus on the planet. It has number of features that cater for different enterprise-integration scenarios. It also supports number of transports including NHTTP, JMS, VFS, Local, SMS, Mail and domain-specific transports such as FIX, HL7. Among those transports, recently I got an opportunity to work a bit on Local Transport. So this post is based on what I have experienced with Local Transport.

Local Transport [2] was first introduced to WSO2 ESB in version 4.0. It helps to communicate with proxy-services in an efficient manner. This gain has obtained by using In-JVM calls when calling to proxy-services. Considering technical side, the sender of Local Transport is implemented based on org.apache.axis2.transport.local.NonBlockingLocalTransportSender , and there’s no receiver implementation.

Enabling Local Transport

To enable Local Transport, you need to follow the following steps:
1. Go to /repository/conf/carbon.xml
2. Replace local://services/ with https://${carbon.local.ip}:${carbon.management.port}${carbon.context}/services/

3. Go to /repository/conf/axis2/axis2.xml
4. Comment the following two lines:

<transportReceiver name="local" class="org.wso2.carbon.core.transports.local.CarbonLocalTransportReceiver"/>
<transportSender name="local" class="org.wso2.carbon.core.transports.local.CarbonLocalTransportSender"/>

5. Add the following line:

<transportSender name="local" class="org.apache.axis2.transport.local.NonBlockingLocalTransportSender"/>

If you need to use local transport with callout mediator, you do not need to perform configuration mentioned in this section as callout mediator requires blocking local transport which is configured by default in WSO2 ESB distribution.

Scenarios

Sample scenario [3] can be find along with WSO2 documentation.
Sample URL: https://docs.wso2.com/display/ESB481/Sample+268%3A+Proxy+Services+with+the+Local+Transport

In the sample you can see there are 3 proxy-services. Once client sends a message to ESB, LocalTransportProxy, SecondProxy and StockQuoteProxy get called sequentially. In that scenario communication between proxy-services handles by In-JVM calls, and that makes less overhead on network traffic.

You can try the same execution chain by resetting the Enabling Local Transport settings and replacing “local://localhost” prefixes with “http://localhost:8280 ” . Then the intercommunication with proxies happen across the network.

If you capture the network traffic with Wireshark for the above 2 scenarios (TCP traffic is filtered);

With Local Transport:

with_local

Without Local Transport:

without_local

As depicts in the first image, with Local Transport you can observe just the requests and responses which are exchanged with external parties (Client and BE service). But without Local Transport, you can see the proxy-service calls happening through the network.

To consider Local Transport

Though Local Transport seems to be an efficient way to communicate, it comes with several limitations which make Local Transport is not the choice.

  1. Local Transport cannot be used to send REST API calls, which require the HTTP/S transports.
  2. WS-Security cannot be used with the local transport. Since the local is mainly used to make calls within the same VM, WS-Security is generally not required in scenarios where it is used.
  3. If you want to make calls across tenants, you should use a non Local Transport even if they run from the same VM.

Conclusion

This post is based on the facts I found about Local Transport so far. So it’s your integration scenario which decides whether Local Transport caters or not. But it’s worth always go for the most efficient way to get the full benefit of service integration software.

References

[1] WSO2 ESB – http://wso2.com/products/enterprise-service-bus/

[2] Local transport – https://docs.wso2.com/display/ESB481/Local+Transport

[3] Local Transport Sample – https://docs.wso2.com/display/ESB481/Sample+268%3A+Proxy+Services+with+the+Local+Transport