You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Grant Edwards <gr...@gmail.com> on 2008/02/19 20:00:26 UTC

Service transactionality

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

Re: Service transactionality

Posted by Grant Edwards <gr...@gmail.com>.
thank you

On Feb 19, 2008 9:58 PM, David E Jones <jo...@hotwaxmedia.com> 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 <jo...@hotwaxmedia.com>
> > 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
> >>
> >>
>
>

Re: Service transactionality

Posted by David E Jones <jo...@hotwaxmedia.com>.
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 <jo...@hotwaxmedia.com>  
> 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
>>
>>


Re: Service transactionality

Posted by Grant Edwards <gr...@gmail.com>.
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 <jo...@hotwaxmedia.com> 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
>
>

Re: Service transactionality

Posted by David E Jones <jo...@hotwaxmedia.com>.
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