Let's say for example we've got a SIMPLE eCommerce system, with two separate systems: an Inventory Management System (IMS) and an Order Management System (OMS). Assume IMS provides information around inventory (getItem, getItemQuantities etc) and OMS provides ordering services (startOrder, addItemToOrder, finalizeOrder etc)
These two systems are implemented as web services using different backends. In OMS, assume a simplistic model like:
public class Order {
private int orderId;
private List LineItem;
...
}
public class LineItem {
private int orderId;
private int itemId;
private int quantity;
private int subTotal;
....
}
In IMS, assume a model like:
public class Category {
private int catId;
private List Item;
...
}
public class Item {
private int itemId;
.... (other attributes)
}
You can easily figure out a simple db table structure to implement the above.
As one use case, consider a client adding an item to an order. This request requires OMS to make several service/database calls:
- Validation of orderId (optional, can pass this responsibility to database).
- Call to IMS to validate passed-in itemId exists (required due to diff DB)
- Call to IMS to validate inventory against passed-in quantity (requred due to diff DB)
- Insertion of new record into table (required)
Does this make sense from a performance perspective? Can you think of a better way?
[EDIT]: As a followup, in the case where a user asks OMS for order details, it can only return orderId, and a list of orderLineItems each containing an itemId, quantity and subTotal. The client actually wants the item's name and description as well. Is the resposibility of retreiving the name/description to the client (through IMS) or is OMS responsible for this?