You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by snowch <sn...@coralms.com> on 2009/07/16 14:53:08 UTC

minilang transactions

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.


Re: minilang transactions

Posted by Scott Gray <sc...@hotwaxmedia.com>.
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.
>>>
>>
>


Re: minilang transactions

Posted by Sumit Pandit <su...@hotwaxmedia.com>.
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.
>>
>


Re: minilang transactions

Posted by Scott Gray <sc...@hotwaxmedia.com>.
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.
>


Re: minilang transactions

Posted by snowch <sn...@coralms.com>.
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.


Re: minilang transactions

Posted by Sumit Pandit <su...@hotwaxmedia.com>.
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.
>>
>


Re: minilang transactions

Posted by Scott Gray <sc...@hotwaxmedia.com>.
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.
>


Re: minilang transactions

Posted by snowch <sn...@coralms.com>.
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.


Re: minilang transactions

Posted by Scott Gray <sc...@hotwaxmedia.com>.
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.
>