Sunday, February 23, 2014

Making events asynchronous in WCS

 All events in websphere commerce are synchronous events by default. Sometimes it is essential to make the events asynchronous to ensure guest is not waiting for the events to complete. For Example, if you are transferring orders to back end system, it can be handled as asynchronous. 
To make the events asynchronous add the priority attribute to the event in wc-server.xml
<component    compClassName="com.ibm.commerce.event.impl.ECEventEnableComponent"
          enable="true" name="OrderSubmit Event" priority="LOW">
            <property display="false">
                <event name="OrderSubmit"/>
            </property>
        </component>
Priority can take 3 values, HIGH, MEDIUM, LOW
HIGH - Will make it synchronous and will run in the same transaction as the event initiator.
MEDIUM - Will make it asynchronous and immediately picked by the event listener. 
LOW - Will run with slight delay as per the scheduler run time and will be processed in a different transaction. 

No comments:

Post a Comment