I just had a looked at the current code, and seems we are building the
message on-demand[1]. In that case, the relevant message will not be build
until it goes to the content-aware mediator level. Hence I think we can go
ahead with the class mediator based approach.

[1]
https://github.com/wso2/wso2-synapse/blob/v2.1.7-wso2v46/modules/core/src/main/java/org/apache/synapse/mediators/AbstractListMediator.java#L93

Thanks.

Regards,
Megala

On Thu, Mar 15, 2018 at 10:13 AM, Shazni Nazeer <[email protected]> wrote:

> I'm not opposed to using the existing validate mediator.
>
> But won't it avoid building the message one extra time by using a class
> mediator?
>
> On Wed, Mar 14, 2018 at 11:05 PM, Megala Uthayakumar <[email protected]>
> wrote:
>
>> Hi Sivaramya,
>>
>> We decided to go for a class mediator without using existing validate
>> mediator to avoid building the message. However, on a second thought, if we
>> add the class mediator inside the insequence of the resource as below,
>>
>> *   <resource methods="POST" url-mapping="/order" faultSequence="fault">*
>> *      <inSequence>*
>> *         <class name ="org.wso2.carbon.apimgt.JsonshemaValidator"/>*
>> *         <property name="api.ut.backendRequestTime"*
>> *                   expression="get-property('SYSTEM_TIME')"/>*
>>
>>
>> AFAIK in synapse level, it will check whether there are any mediators in
>> the in-sequence that is content-aware. If it is content-aware, in synapse
>> level relevant message will be build before starting the in-Sequence. In
>> that case, since we are using the property mediator in insequence, which is
>> content-aware, regardless of whether our class mediator is content-aware or
>> not, the relevant message will be built. In that case, main reason for
>> creating a custom class mediator is invalidated. So how are we going to
>> handle this?
>>
>> If we are ok to build the message before JsonSchemaValidation, can't we
>> use the existing validate mediator itself? WDYT?
>>
>> Thanks.
>>
>> Regards,
>> Megala
>>
>> _______________________________________________
>> Architecture mailing list
>> [email protected]
>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>
>>
>
>
> --
> Shazni Nazeer
>
> Mob : +94 777737331
> LinkedIn : http://lk.linkedin.com/in/shazninazeer
>
> Blogs :
>
> https://medium.com/@mshazninazeer
> http://shazninazeer.blogspot.com
>
> <http://wso2.com/signature>
>



-- 
Megala Uthayakumar

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

Reply via email to