Hi,
Is it possible to wrap a number of service calls into a single transaction? For example, I have a backend process sourcing product information from a 3rd party system and want to call both the "createProduct" and "createProductPrice" service. If for what ever reason the "createProductPrice" service fails I want to roll back all changes to the database that relate to both of these service calls. Kind regards Grant e |
Yes. Usually it's done by creating a service that calls the other two services. By default services will use the transaction in place when they are called, this is really easy. -David On Feb 19, 2008, at 12:00 PM, Grant Edwards wrote: > Hi, > > Is it possible to wrap a number of service calls into a single > transaction? > > For example, I have a backend process sourcing product information > from a > 3rd party system and want to call both the "createProduct" and > "createProductPrice" service. If for what ever reason the > "createProductPrice" service fails I want to roll back all changes > to the > database that relate to both of these service calls. > > Kind regards > > Grant e |
Thank you for the prompt reply, so something similar to this --->
<group name="myProductService" send-mode="all" > <invoke name="createProduct" mode="sync" result-to-context="true"/> <invoke name="createProductPrice" mode="sync"/> </group> One other question, if I call my new service as in .... serviceResult = dispatcher.runSync("myProductService", serviceContext); at what point (and how) do i put the required service parameters into the serviceContext. Different services would have a different requirement in terms of the serviceContext map. Grant e On Feb 19, 2008 9:04 PM, David E Jones <[hidden email]> wrote: > > Yes. Usually it's done by creating a service that calls the other two > services. By default services will use the transaction in place when > they are called, this is really easy. > > -David > > > On Feb 19, 2008, at 12:00 PM, Grant Edwards wrote: > > > Hi, > > > > Is it possible to wrap a number of service calls into a single > > transaction? > > > > For example, I have a backend process sourcing product information > > from a > > 3rd party system and want to call both the "createProduct" and > > "createProductPrice" service. If for what ever reason the > > "createProductPrice" service fails I want to roll back all changes > > to the > > database that relate to both of these service calls. > > > > Kind regards > > > > Grant e > > |
The myProducePrice service should have all of the attributes for both services. The service group stuff will pick out the corresponding attributes (by name) when calling each sub-service. -David On Feb 19, 2008, at 12:53 PM, Grant Edwards wrote: > Thank you for the prompt reply, so something similar to this ---> > > <group name="myProductService" send-mode="all" > > <invoke name="createProduct" mode="sync" result-to- > context="true"/> > <invoke name="createProductPrice" mode="sync"/> > </group> > > > > One other question, if I call my new service as in .... > serviceResult = dispatcher.runSync("myProductService", > serviceContext); > at what point (and how) do i put the required service parameters into > the serviceContext. Different services would have a different > requirement > in terms of the serviceContext map. > > > > Grant e > > > > On Feb 19, 2008 9:04 PM, David E Jones <[hidden email]> > wrote: > >> >> Yes. Usually it's done by creating a service that calls the other two >> services. By default services will use the transaction in place when >> they are called, this is really easy. >> >> -David >> >> >> On Feb 19, 2008, at 12:00 PM, Grant Edwards wrote: >> >>> Hi, >>> >>> Is it possible to wrap a number of service calls into a single >>> transaction? >>> >>> For example, I have a backend process sourcing product information >>> from a >>> 3rd party system and want to call both the "createProduct" and >>> "createProductPrice" service. If for what ever reason the >>> "createProductPrice" service fails I want to roll back all changes >>> to the >>> database that relate to both of these service calls. >>> >>> Kind regards >>> >>> Grant e >> >> |
thank you
On Feb 19, 2008 9:58 PM, David E Jones <[hidden email]> wrote: > > The myProducePrice service should have all of the attributes for both > services. The service group stuff will pick out the corresponding > attributes (by name) when calling each sub-service. > > -David > > > On Feb 19, 2008, at 12:53 PM, Grant Edwards wrote: > > > Thank you for the prompt reply, so something similar to this ---> > > > > <group name="myProductService" send-mode="all" > > > <invoke name="createProduct" mode="sync" result-to- > > context="true"/> > > <invoke name="createProductPrice" mode="sync"/> > > </group> > > > > > > > > One other question, if I call my new service as in .... > > serviceResult = dispatcher.runSync("myProductService", > > serviceContext); > > at what point (and how) do i put the required service parameters into > > the serviceContext. Different services would have a different > > requirement > > in terms of the serviceContext map. > > > > > > > > Grant e > > > > > > > > On Feb 19, 2008 9:04 PM, David E Jones <[hidden email]> > > wrote: > > > >> > >> Yes. Usually it's done by creating a service that calls the other two > >> services. By default services will use the transaction in place when > >> they are called, this is really easy. > >> > >> -David > >> > >> > >> On Feb 19, 2008, at 12:00 PM, Grant Edwards wrote: > >> > >>> Hi, > >>> > >>> Is it possible to wrap a number of service calls into a single > >>> transaction? > >>> > >>> For example, I have a backend process sourcing product information > >>> from a > >>> 3rd party system and want to call both the "createProduct" and > >>> "createProductPrice" service. If for what ever reason the > >>> "createProductPrice" service fails I want to roll back all changes > >>> to the > >>> database that relate to both of these service calls. > >>> > >>> Kind regards > >>> > >>> Grant e > >> > >> > > |
Free forum by Nabble | Edit this page |