Saturday, June 15, 2013

Send Messages to a Given Sequence by Message Injector Task in WSO2 ESB



The third project I was given in ESB was an improvement to Message Injector task in ESB. A task can be scheduled on the ESB to execute periodically. The Message Injector can inject the message to ESB environment. At the time of assigning this project ESB Message Injector could only inject the message to the main sequence and that message should be routed from the main sequence. Therefore it was hard to run lots of tasks in the same time, because there was no way to directly inject a message to a sequence other than the main sequence.

My task was to improve Message Injector task in a way that it can directly send messages to a given sequence. Message Injector task reads some properties from its configuration when it is defined. Therefore I added a new property called “sequence” to task configuration. This sequence property is an optional requirement. If sequence property is not given in the configuration messages will be injected to the main sequence. That means the default sequence of the Message Injector task is the main sequence. 
Message Injector Architecture
I added a new attribute called “injectSequence” to MessageContext. Getters and setters of the injectSequence attribute are included in Axis2MessageContext class which is a child class of MessageContext class. Before Message injector class calls the injectMessage method in Axis2SyanapseEnvironment class, injectSequence attribute is set. If the injectSequence attribute is no null, message will be injected to the sequence specified by injectSequence attribute at the injectMessage method. Above figure shows what I described above. Below figure shows the User interface of the Message Injector task with sequence property. 



User Interface of Message Injector Task








No comments:

Post a Comment