Friday, November 18, 2011

Getting system time within the mediation flow in synapse

There are two default system properties available synapse, which can be used to retrieve the system time/date in a mediation flow..There are usecases, when an user needs to append the system time at the message arrival point to the synapse engine.
Use the property mediator to hold the system time..

<property name="sysDate" expression="get-property('SYSTEM_DATE')" scope="default"
type="STRING"/>
<property name="sysTime" expression="get-property('SYSTEM_TIME')" scope="default" type="STRING"/>

sample sequence would be;

<sequence name="get">
<property name="sysDate" expression="get-property('SYSTEM_DATE')" scope="default" type="STRING"/>
<property name="sysTime" expression="get-property('SYSTEM_TIME')" scope="default" type="STRING"/>
<log>
<property name="SYSTEM TIME IS*******" expression="get-property('sysTime')"/>
</log>
<log>
<property name="SYSTEM DATE IS*******" expression="get-property('sysDate')"/>
</log>
</sequence>



2 comments:

  1. Hi Ratha's
    I have one Query in wso2 Data Service Server:-


    Multiple tables depend on each other with Primary key and foregin key, i used the auto generated key in wso2DSS.

    i am inserted data in 1st table and getting auto genreted identity column, using that identity column again i am inserting in 2nd table as well in 3rd also

    @my issue is while inserting in 2nd table error occure due to pk voilation i need to rollback the 1st table row which is already inserted in table how could i do this ...

    ReplyDelete
  2. This is not relavant to this post. Anyway, Doing rollback need to be handled at your application level/database level.It is nothing realated to dataservice server. By the way, your scenario is very simple.If you get an exception when you try to insert, do a delete operation on the 2nd table..

    ReplyDelete