I got the same Big Smokes Cigar assignment, and here are some of my thoughts, they are half-formed, please correct me if I am wrong.
1. It is not mentioned that what kind of interface the Merchant Bank supports, I think the appropriate assumption could be
a)proprietary API (internet) or Webservice,
b) Proprietary security or SSL solution.
c) No global transaction is supported.
d) Synchronous mode
2. Since the interface with the third party manufactures is JMS, also system needs have high performance, therefore making a synchronous call to JMS provider (MOM), and wait until response comes back is not acceptable. What I am thinking now is the stock's Availability Check should be composed by 2 parts
Async part: there is independent thread which periodically poll third-party inventory system using JMS. We may or may not be able to use MDB. The result needs to be cached and shared somewhere.
Sync part: During the "Search for Cigars" and "Add Cigars to Cart" use cases, the "Stock Availibity" is checked using the result which is cached and shared previously. We may introduce a threshold to define how stale the information is.
3. A technical risk is there is no way to guarantee that the number of units available is accurate. There is no pessimistic like mechanism here, therefore there are always cases where payment is made through, but there is not stock eventually. We may need to consider how to reconcile this situation.
4. Related to point 3, there must be another interaction with third-party inventory logically, that is, after transaction is complete, the system need to update the inventory system to decrease the number of units available. Otherwise the "Check Availability" will never get correct number. I think this extra interaction can be performed asynchronously together with notifying shipping companies.
5. Based on the "Business Domain Model", the relationship b/w products and manufacturers are many-to-many. So generally speaking, a given product and be made by multiple manufacturers. This many-to-many relationship will complicate the "Check Availability". There may need some iteration logic like: if manufacturer A does have enough items, then go to manufacturer b... etc. Then it becomes even worse that one order may involves multiple third-party inventories (say 50 items from A, the other 50 items from B)
6. Login module is not mentioned, we can assume that a 'Login' use case is required. But we don't need to show it in diagrams since it is not the focus.
7. We may or may not store Credit Card information. I was wondering if the testers want to know how we handle storage of credit card in database and memory.
8. In order to resolve the design concern of system performance and availability requirement, the profiling module is required. Also MBean(s) may or may not be required the expose system's healthiness to enterprise monitoring tools like Control-M/Patrol etc.
9. In the "Pay for Cigars" use case, following activities are involved, we need to design how to handle transaction/recovery. Global transaction with email server and Merchant bank is not there.
a) Local database updating
b) Queuing message for stock system update (we may use Topic, instead of Queue)
c) Queuing message for shipping company notification (we may use Topic, instead of Queue)
d) Sending email
e) Payment call to Merchant Bank
I am developing my assignment and I still have doubts if the JMS request/response (temporary topic) is not fixing the 5 seconds restriction, what if I use a timeout model where set availability to 0 if timeout is reached? what about define a SLA with your manufacturers, it can be an assumption? I don't know if design a backgroud process caching the availability is outside of the scope.
About shipping, there is two providers, now when you have to calculate the shipping cost, there is no information how to get it, shipping companies only provide service for accept shipping request and not for calculating price based on quantity, address or weight, then my assumption is that price are fixed and shipping compannies (Shipping methods)should be on the business model too.
Joined: May 31, 2008
Thanks for your comments.
Yes. I agree with you on the assumption about the dependency on the shipping method for shipping fee calculation. We can safely assume that this calculation logic is statically defined in Big Smokes Cigar system through lookup table(s) or configuration files, or other means. No need to make a call to shipping companies upon individual order. The major interaction with shipping companies is to post "completed" orders to them. This interaction should be asynchronous.
As for the "Availability Check", it is crucial. I don't think any messaging venders can provide this kind of SLA (like 5 seconds restriction) under high load. Also please remember for each "BIG" order it may need to invoke multiple third-party inventories. Moreover, there is no way to guarantee the number of availability is precise anyways. In my view there is no other option except an asynchronous approach.