Axis2 Pillars : [ flows, phases, handlers, and modules ]

Flows

Flow is the collection of phases in the Axis2 architecture. There are two flows Axis2 engine has two flows based on the message invocation patterns, 
  1. In-Flow – which is invoked when the engine receives a message
  2. Out-Flow – which is invoked on engine sends the message. 
These flows are not in object or structure on real implementations.  The order in which the phases should be put together to form a flow can be configured in axis2.xml configuration.

Phases

Axis2 engine invokes in the phases which they are placed in flow. 
Axis2 have predefined phases . They also configured in the configuration file axis2.xml
Phases in Flows
PREDEFINED PHASES
The Phases are deined on the element in axis2.xml
https://gist.github.com/anonymous/03fae396998f6683b3ef3b20abc73e02.js User also can add user defined pahses on axis2.xml , but it should be after the post dispatch phase. The example user defined configuration is as follows,

https://gist.github.com/nifrasismail/3657248af776c5921830ca32623dd82d.js

Phase Rules

The main idea of phase rules is to correctly locate a handler relatively to one another inside a phase.
Characterizing a phase rule can be based on one more of the following properties that will be discussed below:
  • Phase name: Name of the phase that the handler must place
  • Phase first (phaseFirst): The first handler of the phase
  • Phase Last (phaseLast): The last handler of the phase
  • Before (before): Should be positioned before a given handler
  • After (after): Should be positioned after a given handler
  • Before and after: Should placed between given two handlers

https://gist.github.com/nifrasismail/42b813e58d67f87b9972d26e9f3a985e.js

Handlers

They are small unit invocations , when the phases is invoked. Each handlers within the phase will be invoked. 
An example for handler is :
AddressingInHandler is places in the predispatch phase in in-flow – it deals with the incoming addressing headers in request. 
AddressingOutHeader is places in the message out phase in out-flow and it prepare out going response message headers and addresses.

Module

Collection of handlers with its configurations are so called modules. Modules enable the user of Axis2 to adding new handlers and phases on their desire. 
when configuring the module user add the module to the pedefined phase of Axis2 Engine. 
First for the all handlers axis2_handler interface needs to be implemented. This means the following signature need to be implemented.
Once the handler is implemented, the module need to implement to API calls as follows
https://gist.github.com/nifrasismail/f4da613bff0162a042161fd9c3ebe1eb.js

engine looking the above implemented functions when loading and unloading the module. Once the above works are ready then they are compiled with the shared library. In order to use the module configuration file is also required. The following is the sample configuration file WS-Addressing scenario.

https://gist.github.com/nifrasismail/ace55e301f4594809f6048c9db38aa09.js

Module Handlers into Phases
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s