tly to her grandpa's address. Not unlike many e-businesses, such as Amazon.com and eBay,
ActionBazaar doesn't make the user wait for the billing process to finish before confirming
an order. Instead, the order is confirmed as soon as it's received and the billing process is
started in parallel in the background. Jenny gets an order confirmation as soon as she clicks
the Order button. Although Jenny doesn't realize it, the process to charge her mom's credit
card starts in the background as she's receiving the confirmation. After the billing process
is finished, both Jenny and Joe are sent email notifications. Having been notified of the re-
ceipt of the money for the order, Joe ships the item, just in time for Jenny's grandpa to get
it before Christmas!
In the next section, you'll see how the business logic components for this set of actions can
be implemented using EJB 3. Before peeking at the solution diagram in the next section,
you should try to visualize how the components might look with respect to an EJB-based
layered architecture. How do you think session beans, CDI, entities, and the JPA 2 API fit
into the picture, given our architectural discussion in chapter 1 ?
2.1.2. An EJB 3-based solution
Figure 2.2 shows how the ActionBazaar scenario in the previous section can be imple-
mented using EJB 3 in a traditional four-tier layering scheme utilizing a domain model.
If you examine the scenario in figure 2.2 , you'll see that only two processes are triggered
by the user: adding a bid to an item and ordering items won. As you might be able to
guess from figure 2.2 , the bidding and ordering processes are implemented as session beans
( BidService and OrderProcessor ) in the business logic tier.