Re: Users - Services and dispatchers
Posted by
Blessing, Jeffrey J on
May 21, 2006; 6:47pm
URL: http://ofbiz.116.s1.nabble.com/Users-Services-and-dispatchers-tp139382p139384.html
My understanding is that it would be potentially hazardous to call a service directly (rather than invoking it using a dispatcher) because of the multi-threaded nature of the server. By using the dispatcher, I believe that the call is wrapped with a Transaction so that any modifications to the database are synchronized among the many other threads that could be possibly modifying the database. Even if a direct call was only a database read, it could still get inconsistent data if the read happens in the middle of some other transaction that's part way through updating data that's common to the two threads. Others on the list may have more to say (I'm still a newcomer to ofbiz and have only run test apps so far).
-Jeff
________________________________
From:
[hidden email] on behalf of Souvik Saha Bhowmik
Sent: Sun 5/21/2006 11:38 AM
To: OFBiz Users / Usage Discussion
Subject: Re: [OFBiz] Users - Services and dispatchers
Hi
This is the Soa concept. The services can be called across application nusing runSynch. If u call the static methods using this PriceServices.calculateProductPrice() , u can only access it from the same application...unless u point to the requirred jar file. But if u use the service name and call using runSynch and passing the service name, u can call the servioce from anywhere. also it helps u call a service from a different server or instance of Ofbiz. In that case u only need the service definition and pass the requirrec parameters. U don need to know its implementation.
On 5/21/06, Firas A. <
[hidden email]> wrote:
Hello,
I need to understand one thing: What's the added value of running services
throw a dispacther. For ex:
dispatcher.runSync("calculateProductPrice", priceContext);
Would it be wrong to call PriceServices.calculateProductPrice() directly
(and pass all the requested parameters to it)?
Thanks!
</Firas>
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users