minilang transactions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

minilang transactions

snowch
If have a service (e.g. svcA) that calls another service (e.g. svcB) as per the pseudo code:

svcA:
  1. lookup entity
  2. modify entity
  3. store entity
  4. call svcB
  5. return

If svcB fails, does step 3 rollback?
Reply | Threaded
Open this post in threaded view
|

Re: minilang transactions

Scott Gray-2
It depends on what you mean by fail:
If svcB triggers a rollback then by default svcA will rollback, see  
the require-new-transaction attribute
If svcB returns failure then svcA won't roll back
If svcB returns error then svcA will rollback by default, see the  
break-on-error attribute

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 17/07/2009, at 12:53 AM, snowch wrote:

>
> If have a service (e.g. svcA) that calls another service (e.g. svcB)  
> as per
> the pseudo code:
>
> svcA:
>  1. lookup entity
>  2. modify entity
>  3. store entity
>  4. call svcB
>  5. return
>
> If svcB fails, does step 3 rollback?
> --
> View this message in context: http://www.nabble.com/minilang-transactions-tp24515741p24515741.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: minilang transactions

snowch
How can I get svcB to return error and to return failure?  In svcB I am using the following to add an error, but it appears that is not causing svcA to rollback...

<add-error><fail-message message="..."/></add-error>

Scott Gray-2 wrote
It depends on what you mean by fail:
If svcB triggers a rollback then by default svcA will rollback, see  
the require-new-transaction attribute
If svcB returns failure then svcA won't roll back
If svcB returns error then svcA will rollback by default, see the  
break-on-error attribute

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 17/07/2009, at 12:53 AM, snowch wrote:

>
> If have a service (e.g. svcA) that calls another service (e.g. svcB)  
> as per
> the pseudo code:
>
> svcA:
>  1. lookup entity
>  2. modify entity
>  3. store entity
>  4. call svcB
>  5. return
>
> If svcB fails, does step 3 rollback?
> --
> View this message in context: http://www.nabble.com/minilang-transactions-tp24515741p24515741.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


 
Reply | Threaded
Open this post in threaded view
|

Re: minilang transactions

Scott Gray-2
The presence of error messages doesn't cause the service to return an  
error, you have to do it explicitly with:
<check-errors/>
or
<return response-code="error"/>

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 17/07/2009, at 1:35 AM, snowch wrote:

>
> How can I get svcB to return error and to return failure?  In svcB I  
> am using
> the following to add an error, but it appears that is not causing  
> svcA to
> rollback...
>
> <add-error><fail-message message="..."/></add-error>
>
>
> Scott Gray-2 wrote:
>>
>> It depends on what you mean by fail:
>> If svcB triggers a rollback then by default svcA will rollback, see
>> the require-new-transaction attribute
>> If svcB returns failure then svcA won't roll back
>> If svcB returns error then svcA will rollback by default, see the
>> break-on-error attribute
>>
>> Regards
>> Scott
>>
>> HotWax Media
>> http://www.hotwaxmedia.com
>>
>> On 17/07/2009, at 12:53 AM, snowch wrote:
>>
>>>
>>> If have a service (e.g. svcA) that calls another service (e.g. svcB)
>>> as per
>>> the pseudo code:
>>>
>>> svcA:
>>> 1. lookup entity
>>> 2. modify entity
>>> 3. store entity
>>> 4. call svcB
>>> 5. return
>>>
>>> If svcB fails, does step 3 rollback?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/minilang-transactions-tp24515741p24515741.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/minilang-transactions-tp24515741p24516505.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: minilang transactions

Sumit Pandit-3
Though both options provided by Scott are correct, <check-errors/> is  
a common practice, you can find many examples of both.

Regards
Sumit Pandit.
On Jul 16, 2009, at 7:15 PM, Scott Gray wrote:

> The presence of error messages doesn't cause the service to return  
> an error, you have to do it explicitly with:
> <check-errors/>
> or
> <return response-code="error"/>
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 17/07/2009, at 1:35 AM, snowch wrote:
>
>>
>> How can I get svcB to return error and to return failure?  In svcB  
>> I am using
>> the following to add an error, but it appears that is not causing  
>> svcA to
>> rollback...
>>
>> <add-error><fail-message message="..."/></add-error>
>>
>>
>> Scott Gray-2 wrote:
>>>
>>> It depends on what you mean by fail:
>>> If svcB triggers a rollback then by default svcA will rollback, see
>>> the require-new-transaction attribute
>>> If svcB returns failure then svcA won't roll back
>>> If svcB returns error then svcA will rollback by default, see the
>>> break-on-error attribute
>>>
>>> Regards
>>> Scott
>>>
>>> HotWax Media
>>> http://www.hotwaxmedia.com
>>>
>>> On 17/07/2009, at 12:53 AM, snowch wrote:
>>>
>>>>
>>>> If have a service (e.g. svcA) that calls another service (e.g.  
>>>> svcB)
>>>> as per
>>>> the pseudo code:
>>>>
>>>> svcA:
>>>> 1. lookup entity
>>>> 2. modify entity
>>>> 3. store entity
>>>> 4. call svcB
>>>> 5. return
>>>>
>>>> If svcB fails, does step 3 rollback?
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/minilang-transactions- 
>>>> tp24515741p24515741.html
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/minilang-transactions-tp24515741p24516505.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: minilang transactions

Sumit Pandit-3
In reply to this post by Scott Gray-2
Hello Scott,

I saw a behavior of system during rollback.
In same example if svcA created a primary key with ID = 10000, and if  
due to any error in svcB then it rollback the transaction.

And then in next turn when we try to run it again then it creates the  
primary key with Id = 10001 (where I was expected for 10000), is this  
correct?

--
Regards
Sumit Pandit
On Jul 16, 2009, at 6:52 PM, Scott Gray wrote:

> It depends on what you mean by fail:
> If svcB triggers a rollback then by default svcA will rollback, see  
> the require-new-transaction attribute
> If svcB returns failure then svcA won't roll back
> If svcB returns error then svcA will rollback by default, see the  
> break-on-error attribute
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 17/07/2009, at 12:53 AM, snowch wrote:
>
>>
>> If have a service (e.g. svcA) that calls another service (e.g.  
>> svcB) as per
>> the pseudo code:
>>
>> svcA:
>> 1. lookup entity
>> 2. modify entity
>> 3. store entity
>> 4. call svcB
>> 5. return
>>
>> If svcB fails, does step 3 rollback?
>> --
>> View this message in context: http://www.nabble.com/minilang-transactions-tp24515741p24515741.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: minilang transactions

Scott Gray-2
Hi Sumit

Yes that's right, the ids are cached in batches of 10 so the rollback  
wouldn't have any effect on each delegator.getNextSeqId call.

Regards
Scott

On 17/07/2009, at 2:17 AM, Sumit Pandit wrote:

> Hello Scott,
>
> I saw a behavior of system during rollback.
> In same example if svcA created a primary key with ID = 10000, and  
> if due to any error in svcB then it rollback the transaction.
>
> And then in next turn when we try to run it again then it creates  
> the primary key with Id = 10001 (where I was expected for 10000), is  
> this correct?
>
> --
> Regards
> Sumit Pandit
> On Jul 16, 2009, at 6:52 PM, Scott Gray wrote:
>
>> It depends on what you mean by fail:
>> If svcB triggers a rollback then by default svcA will rollback, see  
>> the require-new-transaction attribute
>> If svcB returns failure then svcA won't roll back
>> If svcB returns error then svcA will rollback by default, see the  
>> break-on-error attribute
>>
>> Regards
>> Scott
>>
>> HotWax Media
>> http://www.hotwaxmedia.com
>>
>> On 17/07/2009, at 12:53 AM, snowch wrote:
>>
>>>
>>> If have a service (e.g. svcA) that calls another service (e.g.  
>>> svcB) as per
>>> the pseudo code:
>>>
>>> svcA:
>>> 1. lookup entity
>>> 2. modify entity
>>> 3. store entity
>>> 4. call svcB
>>> 5. return
>>>
>>> If svcB fails, does step 3 rollback?
>>> --
>>> View this message in context: http://www.nabble.com/minilang-transactions-tp24515741p24515741.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: minilang transactions

snowch
In reply to this post by Scott Gray-2
So <check-errors/> will return immediately without executing any code following it if there are any errors?

Scott Gray-2 wrote
The presence of error messages doesn't cause the service to return an  
error, you have to do it explicitly with:
<check-errors/>
or
<return response-code="error"/>

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 17/07/2009, at 1:35 AM, snowch wrote:

>
> How can I get svcB to return error and to return failure?  In svcB I  
> am using
> the following to add an error, but it appears that is not causing  
> svcA to
> rollback...
>
> <add-error><fail-message message="..."/></add-error>
>
>
> Scott Gray-2 wrote:
>>
>> It depends on what you mean by fail:
>> If svcB triggers a rollback then by default svcA will rollback, see
>> the require-new-transaction attribute
>> If svcB returns failure then svcA won't roll back
>> If svcB returns error then svcA will rollback by default, see the
>> break-on-error attribute
>>
>> Regards
>> Scott
>>
>> HotWax Media
>> http://www.hotwaxmedia.com
>>
>> On 17/07/2009, at 12:53 AM, snowch wrote:
>>
>>>
>>> If have a service (e.g. svcA) that calls another service (e.g. svcB)
>>> as per
>>> the pseudo code:
>>>
>>> svcA:
>>> 1. lookup entity
>>> 2. modify entity
>>> 3. store entity
>>> 4. call svcB
>>> 5. return
>>>
>>> If svcB fails, does step 3 rollback?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/minilang-transactions-tp24515741p24515741.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/minilang-transactions-tp24515741p24516505.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


 
Reply | Threaded
Open this post in threaded view
|

Re: minilang transactions

Scott Gray-2
Correct

Regards
Scott

On 17/07/2009, at 3:11 AM, snowch wrote:

>
> So <check-errors/> will return immediately without executing any code
> following it if there are any errors?
>
>
> Scott Gray-2 wrote:
>>
>> The presence of error messages doesn't cause the service to return an
>> error, you have to do it explicitly with:
>> <check-errors/>
>> or
>> <return response-code="error"/>
>>
>> Regards
>> Scott
>>
>> HotWax Media
>> http://www.hotwaxmedia.com
>>
>> On 17/07/2009, at 1:35 AM, snowch wrote:
>>
>>>
>>> How can I get svcB to return error and to return failure?  In svcB I
>>> am using
>>> the following to add an error, but it appears that is not causing
>>> svcA to
>>> rollback...
>>>
>>> <add-error><fail-message message="..."/></add-error>
>>>
>>>
>>> Scott Gray-2 wrote:
>>>>
>>>> It depends on what you mean by fail:
>>>> If svcB triggers a rollback then by default svcA will rollback, see
>>>> the require-new-transaction attribute
>>>> If svcB returns failure then svcA won't roll back
>>>> If svcB returns error then svcA will rollback by default, see the
>>>> break-on-error attribute
>>>>
>>>> Regards
>>>> Scott
>>>>
>>>> HotWax Media
>>>> http://www.hotwaxmedia.com
>>>>
>>>> On 17/07/2009, at 12:53 AM, snowch wrote:
>>>>
>>>>>
>>>>> If have a service (e.g. svcA) that calls another service (e.g.  
>>>>> svcB)
>>>>> as per
>>>>> the pseudo code:
>>>>>
>>>>> svcA:
>>>>> 1. lookup entity
>>>>> 2. modify entity
>>>>> 3. store entity
>>>>> 4. call svcB
>>>>> 5. return
>>>>>
>>>>> If svcB fails, does step 3 rollback?
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/minilang-transactions-tp24515741p24515741.html
>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/minilang-transactions-tp24515741p24516505.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/minilang-transactions-tp24515741p24518337.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


smime.p7s (3K) Download Attachment