Hi all,

I am working on implementing native JSON support for Synapse mediators. As
part of the effort, we have to implement JSON support in all the relevant
mediators and currently we have implemented native JSON support to Iterate,
Aggregate and Enrich mediators. We have to implement it for ForEach,
Header, Publish Event, Rule and Call Template mediator. Other mediators
either already have JSON support or not relevant to handling JSON payloads
(eg XSLT mediator). Please see the attachment for a complete analysis.

Initially all the JSON payloads sent to the Synapse got transformed into
XML and all the mediators manipulated the payload as XML using XPath. This
approach led to some issues such as some of the original information in the
JSON payload was lost during the conversion. As a remedy, it was decided to
implement native JSON support to the mediators. The original payload exists
as a stream in the Message Context and the JSON supported mediators use
that stream to do the data manipulation and after the manipulation, the
stream and the SOAP envelope are updated. Currently the problem is that, to
handle JSON payloads natively, we can only use JSON supported mediators in
the mediation. If we use a non JSON supported mediator, the JSON payload in
the JSON stream becomes obsolete and we have to use XPath to manipulate the
JSON payload in the remaining mediators.

As a solution, we can implement JSON support for all the relevant mediators
and minimize this problem. This solution is totally backward compatible and
existing users can continue to manipulate JSON payload via XPath if they
want. To give users more control over the payload, we are also planning to
introduce a new Transform mediator which will take a payload and a schema
as input, and it will give out a modified payload according to the schema
as output.


[image: Transform mediator (2).png]
Any suggestions or concerns are highly appreciated.

Thanks & Regards,
Arunan

-- 
*Sugunakumar Arunan*
Software Engineer | WSO2

Email : [email protected]
Mobile : +94766016272
Web : http://wso2.com
<https://wso2.com/signature>

Attachment: EI Mediators analysis.pdf
Description: Adobe PDF document

_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to