IBM Support

getOrderList API does not return updated status when called by the ON_STATUS_CHANGE event of changeOrderStatus

Troubleshooting


Problem

On status change of the order, the ON_STATUS_CHANGE event was enabled to call the API getOrderList. Consider a scenario where the order moved from Created to Scheduled status. When this transition occurs, the ON_STATUS_CHANGE event is called and getOrderList is invoked. However the out put of getOrderList shows the status as Created and not Scheduled

Cause

This is due to synchronous nature of the events. getOrderList is synchronously called as part of the status change by the ON_STATUS_CHANGE event.

Diagnosing The Problem

The status change of the order and the on success event are being called as a part of a synchronous call in the same transaction boundary, the changes to the database are committed only when the entire transaction is completed. Since the status change is not committed to the database yet, getOrderList does not return the uncommitted value for the status.

Resolving The Problem

In order to get the latest status of the order, implement the getOrderList call as an asynchronous service after the status change.

One way to implement :-
1. Create a service to drop a message to a queue. Call this service as a part of ON_STATUS_CHANGE event to publish messages to the queue. This message published will be the details in the CHANGE_ORDER_STATUS.ON_STATUS_CHANGE.xml.

Refer to the java docs for details of this XML.


2. CHANGE_ORDER_STATUS.ON_STATUS_CHANGE.xml contains the order_header_key


3. Configure an agent to call getOrderList. This agent can read the messages from the queue in step 1, Use the order header key and proceed to retrieve the latest status.

[{"Product":{"code":"SS6PEW","label":"Sterling Order Management"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"--","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"}],"Version":"9.3;9.4;9.5","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Document Information

Modified date:
16 June 2018

UID

swg22002194