Wednesday, October 3, 2012

How to Specify Default Message Builder and Message Formatter in Axis2

By default Axis2 message builders and formatters are registered against a content type. But there might be situations that you might need to specify a default message builder/formatter in Axis2.

This can be achieved by specifying a regular expression as the contentType. Then, Axis2 will first try to find a matching message builder/formatter for your content type and when it couldn't find a match, it will try to match against the regular expressions which we have specified.

Using this functionality, you can either register a default builder/formatter or one builder/formatter pair for a set of content types which matches to the given regular expression.

Further, if you are using binary relay feature of WSO2 ESB or WSO2 ELB(Elasting Load Balancer), then you will feel the ease of using regular expressions to specify BinaryRelayBuilder and ExpandingMessageFormatter.
<messageBuilder contentType=".*" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>

<messageFormatter contentType=".*" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>

No comments:

Post a Comment