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 |
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, _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
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 winmail.dat (6K) Download Attachment |
All of these are correct responses. One thing to know when using
services in your applications. You do NOT care where this service lives or how it is implemented. Only what is required to invoke it (name, parameters, permissions, etc). One example is the create order service. Currently you CAN invoke this service by calling OrderServices.createOrder(). However, it is planned to remove this completely to simple methods and split it up into smaller parts. When this is done, any code which calls this directly will no longer work. However, if you run it though the service engine, it takes care of knowing where and how to invoke this service. Your code will continue to function without modification. Andy On May 21, 2006, at 1:47 PM, Blessing, Jeffrey J wrote: > 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 > > > > <winmail.dat> > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Free forum by Nabble | Edit this page |