Asyc 1-Phase mode should be removed
-----------------------------------
Key: DAYTRADER-29
URL: http://issues.apache.org/jira/browse/DAYTRADER-29
Project: DayTrader
Issue Type: Improvement
Components: EJB Tier
Affects Versions: 1.2, 2.0
Reporter: Christopher James Blythe
Here are some comments that I added to DT-22...
Since my involvement with Daytrader (and Trade), we've never been all that
concerned with the Async 1-phase mode. Here is the lay of the land to my
understanding...
Sync mode
- Uses JMS topics and TradeTopicMDB to publish changes to the quote prices
- There is flag in the DDs to disable this but it doesn't seem to apply to
direct mode (only EJB mode)
Async 2-phase mode
- This mode uses a JMS queue and the TradeBroker to handle order processing
- Specifically, the buy and sell operations call a queueOrder method to place
a message on the queue
- The queueOrder is part of an XA transaction because two resource managers
(JMS and database) are involved to create the order in the databse and place a
message on the queue
- The MDB starts a new transaction when the message is read from the queue. The
MDB then executes the completeOrder method which updates the order in the
database inside the original MDB transaction context
Async 1-phase mode
- Does the same as above, but does not involve an UserTransaction to provide XA
- Since the MDB is container-managed, TradeEJB is used to complete the order
and create a new transaction (avoiding XA)
My guess is that the Async 1-phase mode was added to messure the overhead
associated with handling the XA transaction.
I have never found that much value in Async 1-phase mode. If you are using two
different resources as part of a logical transaction, you should always use XA
to ensure proper rollback handling. Honestly, I see very little need to keep it
around... However, there might be some possiblities I have not considered. As
an added benefit of removing this option, we would remove a dependency between
the TradeDirect and TradeBean code.
I also like the idea of splitting up the modes by category and doing a little
renaming to make them more descriptive.
Persistence Run-time Modes (one has to be selected)
1) Direct (or JDBC)
2) Stateless Session Bean to Direct
3) Full EJB (Stateless Session Bean to Entity Beans)
JMS Support Enablement (any can be selected)
- Publish Quote Updates (Publish quote price changes to a JMS topic)
- Process Buy/Sell Orders using XA (Asychronously process buy/sell orders by
placing them on a JMS queue. An MDB is then responsible for reading a message
form the queue and completing the order)
Thoughts?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira