Skip to main content

Extending WSO2 ESB with a Custom Transport Implementation - Part I

WSO2 ESB is considered as one of the best and highest performing open source integration solutions available in the market. One of the astonishing features of the WSO2 ESB is the extensibility of the solution to meet your custom requirements. This means a LOT, if you have dealt with proprietary solutions provided big players (you name it). With this blog post, I will be discussing about one of the not so frequently used but THE BEST extension point in WSO2 ESB which is implementing a custom transport.

Given that WSO2 ESB is an extensible solution, that does not mean that it is lacking OOTB features. In fact it provides the most complete feature set provided by any open source integration solution in the market. But as you know, it is not a silver bullet (In fact we can't make silver bullets). Therefore, you may encounter some scenarios where you need to write a custom transport implementation to connect with one of your systems.

I will be taking ISO8583 messaging standard to write this custom transport implementation. It is used heavily in the financial transactions domain for credit card transaction processing. One of the reasons to select this as my custom transport implementation is that there is an already written code for this transport by Manoj Fernando in this blog post. Since my focus of this blog post is to describe about writing a custom transport implementation, I think I am not re-writing what Manoj has written.

Enough talking. Let's do some real work. WSO2 ESB mediation engine can be depicted in the following diagram.



  • As depicted in the above diagram, requests/responses coming from clients/servers (Inbound) will be hitting the ESB through the transport layer. It will select the proper transport receiver  implementation by looking at the request URI (eg: HTTP, TCP, JMS, etc.)
  • Transport will hand over this message to the appropriate message builder according to the content-type (if specified) specified in the message.
  • Then the message will be handed over to the Axis engine(In Flow) where it does the QOS related operations. 
  • After that, message will be handed over to the mediation engine for executing the mediation logic configured with mediators.
  • Then again, message will be going through the Axis engine (Out Flow) for any QOS related operations.
  • Message formatter will be selected according to the content-type provided in the message.
  • Then the message will be passed back to the relevant transport sender implementation to send the message from ESB to client/server (Outbound)

Alright.. Alright .. Now we know what happens to a message coming towards the WSO2 ESB and what happens when message is going out of the same. I have highlighted 4 terms in the previous section. Those 4 terms are


  • Transport Receiver
  • Message Builder
  • Message Formatter
  • Transport Sender
These would be the classes we need to implement for our custom transport implementation. WSO2 ESB has provided the interfaces for these implementations such that you need to focus only on the business logic rather than knowing the internals of WSO2 ESB. We will be using following interfaces to write our custom implementation.

  • org.apache.axis2.transport.base.AbstractTransportListener
  • org.apache.axis2.builder.Builder
  • org.apache.axis2.transport.MessageFormatter
  • org.apache.axis2.transport.base.AbstractTransportSender
Now we have the ground covered for our custom transport implementation. Let's do some coding. I will be transferring this discussion to my next blog post since this is getting too long here.

http://soatutorials.blogspot.com/2015/06/extending-wso2-esb-with-custom_21.html

Comments

Post a Comment

Popular posts from this blog

Understanding Threads created in WSO2 ESB

WSO2 ESB is an asynchronous high performing messaging engine which uses Java NIO technology for its internal implementations. You can find more information about the implementation details about the WSO2 ESB’s high performing http transport known as Pass-Through Transport (PTT) from the links given below. [1] http://soatutorials.blogspot.com/2015/05/understanding-wso2-esb-pass-through.html [2] http://wso2.com/library/articles/2013/12/demystifying-wso2-esb-pass-through-transport-part-i/ From this tutorial, I am going to discuss about various threads created when you start the ESB and start processing requests with that. This would help you to troubleshoot critical ESB server issues with the usage of a thread dump. You can monitor the threads created by using a monitoring tool like Jconsole or java mission control (java 1.7.40 upwards). Given below is a list of important threads and their stack traces from an active ESB server.  PassThroughHTTPSSender ( 1 Thread )

How to configure timeouts in WSO2 ESB to get rid of client timeout errors

WSO2 ESB has defined some configuration parameters which controls the timeout of a particular request which is going out of ESB. In a particular  scneario, your client sends a request to ESB, and then ESB sends a request to another endpoint to serve the request. CLIENT->WSO2 ESB->BACKEND The reason for clients getting timeout is that ESB timeout is larger than client's timeout. This can be solved by either increasing the timeout at client side or by decreasing the timeout in ESB side. In any of the case, you can control the timeout in ESB using the below properties. 1) Global timeout defined in synapse.properties (ESB_HOME\repository\conf\) file. This will decide the maximum time that a callback is waiting in the ESB for a response for a particular request. If ESB does not get any response from Back End, it will drop the message and clears out the call back. This is a global level parameter which affects all the endpoints configured in ESB. synapse.global_timeout_inte

WSO2 ESB tuning performance with threads

I have written several blog posts explaining the internal behavior of the ESB and the threads created inside ESB. With this post, I am talking about the effect of threads in the WSO2 ESB and how to tune up threads for optimal performance. You can refer [1] and [2] to understand the threads created within the ESB. [1] http://soatutorials.blogspot.com/2015/05/understanding-threads-created-in-wso2.html [2] http://wso2.com/library/articles/2012/03/importance-performance-wso2-esb-handles-nonobvious/ Within this blog post, I am discussing about the "worker threads" which are used for processing the data within the WSO2 ESB. There are 2 types of worker threads created when you start sending the requests to the server 1) Server Worker/Client Worker Threads 2) Mediator Worker (Synapse-Worker) Threads Server Worker/Client Worker Threads These set of threads will be used to process all the requests/responses coming to the ESB server. ServerWorker Threads will be used to pr