Hi, Is this a plausible solution to handling stock control? 1. A user adds a product to his shopping cart. 2. The user then clicks on the check out link. This creates an order in the repos /content/webshop/customer/orders/unique_order_name with a property called state set to new. 3. The user then gets a wait page that keeps polling /content/webshop/customer/orders/new/unique_order_name until state changes to assigned or error. 4. When the state has changed the user sees an appropriate page.
After step 2 a observer (maybe a job is better suited) is fired that performs the stock allocation and updates the order state. The job or observer would need to only process one order at a time to make sure that the stock levels are updated correctly. Regards Ben Short 2009/8/17 Ben Short <[email protected]> > Hi, > > So a possible solution would be to create a POST.esp at > /content/myshop/orders and perform the 'check out' process in there. > Which might follow the following steps.. > > 1. Check stock availability > 2. Create order - take customer address details etc > 3. Update stock levels > 4. Redirect customer to payment processor > > Am i correct in assuming that the 4 steps would occur in a single > sling/jackrabbit transaction. As the repository is opened, updated and > the changes are commited in each http transaction. > > Sorry if I have the terminology a little off, im still learning :) > > Regards > > Ben Short > > 2009/8/17 Felix Meschberger <[email protected]>: > > Hi, > > > > Ben Short schrieb: > >> Hi, > >> > >> I'm wondering about the suitability of Sling and Jackrabbit for > >> ecommerce applications. Typically the product catalog, stock control, > >> orders etc are stored in a fixed structure in a database. Orders and > >> stock control are updated in a transaction so that you can't order > >> more than the number of products in stock. > >> > >> How do people feel about Sling handling this kind of application? > > > > If you do it right -- MVC style -- you can use the Sling/Jackrabbit > > combo just as you would use a database with <name-a-fraemwork-here>. > > > > For transactionality Jackrabbit supports regular JTA-transactions > > (consider carefully, whether you really, really need real transactions). > > Or you can use other JCR features to be able to control not selling more > > than you have. > > > > Regards > > Felix > > > > >
