error handling in simple methods

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

error handling in simple methods

Vince Clark
I am importing a large amount of customer and order data. I am iterating thru the result set using the simple-method <iterate> tag and if I hit one bad record the whole job fails. How can I trap and log errors and continue?


Vince Clark
[hidden email]
(303) 493-6723
Reply | Threaded
Open this post in threaded view
|

Re: error handling in simple methods

David E. Jones-2

That sounds like the expected behavior when you are running in a  
transaction. If you don't want it to behave differently you can turn  
off the transaction stuff for the service engine and simple-method, or  
inside your loop call a service with require-new-transaction=true  
(just watch out when you do that one if you are modifying records you  
are iterating over, you may end up with a dead-lock, or if you're  
lucky then a more immediate db error).

-David


On Jul 22, 2009, at 3:02 PM, Vince Clark wrote:

> I am importing a large amount of customer and order data. I am  
> iterating thru the result set using the simple-method <iterate> tag  
> and if I hit one bad record the whole job fails. How can I trap and  
> log errors and continue?
>
>
> Vince Clark
> [hidden email]
> (303) 493-6723

Reply | Threaded
Open this post in threaded view
|

Re: error handling in simple methods

BJ Freeman
In reply to this post by Vince Clark
another approach may be to call another simple method from the iterate.
that method does the store and you can use use-transaction
this would make it per record.

Vince Clark sent the following on 7/22/2009 2:02 PM:
> I am importing a large amount of customer and order data. I am iterating thru the result set using the simple-method <iterate> tag and if I hit one bad record the whole job fails. How can I trap and log errors and continue?
>
>
> Vince Clark
> [hidden email]
> (303) 493-6723
>

--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.

Reply | Threaded
Open this post in threaded view
|

Re: error handling in simple methods

David E. Jones-2

To clarify: the sub-method (sub-service really) would ONLY be in a  
separate transaction if you use the require-new-transaction attribute  
on the service definition.

-David


On Jul 22, 2009, at 3:48 PM, BJ Freeman wrote:

> another approach may be to call another simple method from the  
> iterate.
> that method does the store and you can use use-transaction
> this would make it per record.
>
> Vince Clark sent the following on 7/22/2009 2:02 PM:
>> I am importing a large amount of customer and order data. I am  
>> iterating thru the result set using the simple-method <iterate> tag  
>> and if I hit one bad record the whole job fails. How can I trap and  
>> log errors and continue?
>>
>>
>> Vince Clark
>> [hidden email]
>> (303) 493-6723
>>
>
> --
> BJ Freeman
> http://www.businessesnetwork.com/automation
> http://bjfreeman.elance.com
> http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
> Systems Integrator.
>

Reply | Threaded
Open this post in threaded view
|

Re: error handling in simple methods

Vince Clark
Thanks for the clarification David. I have been using require-new-transaction when calling services, but as far as I can tell there is not an equivalent option for calling simple methods. For example, I am calling the simple-method "createPersonRoleAndContactMechs" which is not defined as a service. If I wanted to use a transaction for each iteration I would need to create a service definition for the simple method, correct?


Vince Clark
[hidden email]
(303) 493-6723

----- Original Message -----
From: "David E Jones" <[hidden email]>
To: [hidden email]
Sent: Wednesday, July 22, 2009 3:53:08 PM GMT -07:00 US/Canada Mountain
Subject: Re: error handling in simple methods


To clarify: the sub-method (sub-service really) would ONLY be in a  
separate transaction if you use the require-new-transaction attribute  
on the service definition.

-David


On Jul 22, 2009, at 3:48 PM, BJ Freeman wrote:

> another approach may be to call another simple method from the  
> iterate.
> that method does the store and you can use use-transaction
> this would make it per record.
>
> Vince Clark sent the following on 7/22/2009 2:02 PM:
>> I am importing a large amount of customer and order data. I am  
>> iterating thru the result set using the simple-method <iterate> tag  
>> and if I hit one bad record the whole job fails. How can I trap and  
>> log errors and continue?
>>
>>
>> Vince Clark
>> [hidden email]
>> (303) 493-6723
>>
>
> --
> BJ Freeman
> http://www.businessesnetwork.com/automation
> http://bjfreeman.elance.com
> http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
> Systems Integrator.
>

Reply | Threaded
Open this post in threaded view
|

Re: error handling in simple methods

David E. Jones-2

Yep.

-David


On Jul 22, 2009, at 4:00 PM, Vince Clark wrote:

> Thanks for the clarification David. I have been using require-new-
> transaction when calling services, but as far as I can tell there is  
> not an equivalent option for calling simple methods. For example, I  
> am calling the simple-method "createPersonRoleAndContactMechs" which  
> is not defined as a service. If I wanted to use a transaction for  
> each iteration I would need to create a service definition for the  
> simple method, correct?
>
>
> Vince Clark
> [hidden email]
> (303) 493-6723
>
> ----- Original Message -----
> From: "David E Jones" <[hidden email]>
> To: [hidden email]
> Sent: Wednesday, July 22, 2009 3:53:08 PM GMT -07:00 US/Canada  
> Mountain
> Subject: Re: error handling in simple methods
>
>
> To clarify: the sub-method (sub-service really) would ONLY be in a
> separate transaction if you use the require-new-transaction attribute
> on the service definition.
>
> -David
>
>
> On Jul 22, 2009, at 3:48 PM, BJ Freeman wrote:
>
>> another approach may be to call another simple method from the
>> iterate.
>> that method does the store and you can use use-transaction
>> this would make it per record.
>>
>> Vince Clark sent the following on 7/22/2009 2:02 PM:
>>> I am importing a large amount of customer and order data. I am
>>> iterating thru the result set using the simple-method <iterate> tag
>>> and if I hit one bad record the whole job fails. How can I trap and
>>> log errors and continue?
>>>
>>>
>>> Vince Clark
>>> [hidden email]
>>> (303) 493-6723
>>>
>>
>> --
>> BJ Freeman
>> http://www.businessesnetwork.com/automation
>> http://bjfreeman.elance.com
>> http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
>> Systems Integrator.
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: error handling in simple methods

BJ Freeman
In reply to this post by BJ Freeman
so the use-transaction and begin-transaction and commit-transaction of
the mini language is not independent in each simple method, if just used
in simple methods?


David E Jones sent the following on 7/22/2009 2:53 PM:

>
> To clarify: the sub-method (sub-service really) would ONLY be in a
> separate transaction if you use the require-new-transaction attribute on
> the service definition.
>
> -David
>
>
> On Jul 22, 2009, at 3:48 PM, BJ Freeman wrote:
>
>> another approach may be to call another simple method from the iterate.
>> that method does the store and you can use use-transaction
>> this would make it per record.
>>
>> Vince Clark sent the following on 7/22/2009 2:02 PM:
>>> I am importing a large amount of customer and order data. I am
>>> iterating thru the result set using the simple-method <iterate> tag
>>> and if I hit one bad record the whole job fails. How can I trap and
>>> log errors and continue?
>>>
>>>
>>> Vince Clark
>>> [hidden email]
>>> (303) 493-6723
>>>
>>
>> --
>> BJ Freeman
>> http://www.businessesnetwork.com/automation
>> http://bjfreeman.elance.com
>> http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
>>
>> Systems Integrator.
>>
>
>

--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.

Reply | Threaded
Open this post in threaded view
|

Re: error handling in simple methods

David E. Jones-2

Right now there is no "suspend-transaction" operation, so you would  
have to make sure the simple-method is not called by anything that  
puts a transaction in place, and then manually manage the transaction  
in the simple-method, which would mean that you can't use an list-
iterator for the result to iterate over because you'll have to query  
for that list, commit the transaction for that, then loop over the  
results doing a transaction for each.

On a side note, the call-service operation in a simple-method also has  
a require-new-transaction attribute so you can call a sub-service in a  
separate transaction without the service itself having require-new-
transaction=true.

On another side note for Vince: be careful about wanting to have  
things succeed or fail independently. When you do that it usually  
means you have to build something else to track and handle the error  
cases, which can be a lot of extra work and if not done will require  
error-prone manual work.

-David


On Jul 22, 2009, at 4:03 PM, BJ Freeman wrote:

> so the use-transaction and begin-transaction and commit-transaction of
> the mini language is not independent in each simple method, if just  
> used
> in simple methods?
>
>
> David E Jones sent the following on 7/22/2009 2:53 PM:
>>
>> To clarify: the sub-method (sub-service really) would ONLY be in a
>> separate transaction if you use the require-new-transaction  
>> attribute on
>> the service definition.
>>
>> -David
>>
>>
>> On Jul 22, 2009, at 3:48 PM, BJ Freeman wrote:
>>
>>> another approach may be to call another simple method from the  
>>> iterate.
>>> that method does the store and you can use use-transaction
>>> this would make it per record.
>>>
>>> Vince Clark sent the following on 7/22/2009 2:02 PM:
>>>> I am importing a large amount of customer and order data. I am
>>>> iterating thru the result set using the simple-method <iterate> tag
>>>> and if I hit one bad record the whole job fails. How can I trap and
>>>> log errors and continue?
>>>>
>>>>
>>>> Vince Clark
>>>> [hidden email]
>>>> (303) 493-6723
>>>>
>>>
>>> --
>>> BJ Freeman
>>> http://www.businessesnetwork.com/automation
>>> http://bjfreeman.elance.com
>>> http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
>>>
>>> Systems Integrator.
>>>
>>
>>
>
> --
> BJ Freeman
> http://www.businessesnetwork.com/automation
> http://bjfreeman.elance.com
> http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
> Systems Integrator.
>

Reply | Threaded
Open this post in threaded view
|

Re: error handling in simple methods

BJ Freeman
In reply to this post by BJ Freeman
thank you.

David E Jones sent the following on 7/22/2009 3:18 PM:

>
> Right now there is no "suspend-transaction" operation, so you would have
> to make sure the simple-method is not called by anything that puts a
> transaction in place, and then manually manage the transaction in the
> simple-method, which would mean that you can't use an list-iterator for
> the result to iterate over because you'll have to query for that list,
> commit the transaction for that, then loop over the results doing a
> transaction for each.
>
> On a side note, the call-service operation in a simple-method also has a
> require-new-transaction attribute so you can call a sub-service in a
> separate transaction without the service itself having
> require-new-transaction=true.
>
> On another side note for Vince: be careful about wanting to have things
> succeed or fail independently. When you do that it usually means you
> have to build something else to track and handle the error cases, which
> can be a lot of extra work and if not done will require error-prone
> manual work.
>
> -David
>
>
> On Jul 22, 2009, at 4:03 PM, BJ Freeman wrote:
>
>> so the use-transaction and begin-transaction and commit-transaction of
>> the mini language is not independent in each simple method, if just used
>> in simple methods?
>>
>>
>> David E Jones sent the following on 7/22/2009 2:53 PM:
>>>
>>> To clarify: the sub-method (sub-service really) would ONLY be in a
>>> separate transaction if you use the require-new-transaction attribute on
>>> the service definition.
>>>
>>> -David
>>>
>>>
>>> On Jul 22, 2009, at 3:48 PM, BJ Freeman wrote:
>>>
>>>> another approach may be to call another simple method from the iterate.
>>>> that method does the store and you can use use-transaction
>>>> this would make it per record.
>>>>
>>>> Vince Clark sent the following on 7/22/2009 2:02 PM:
>>>>> I am importing a large amount of customer and order data. I am
>>>>> iterating thru the result set using the simple-method <iterate> tag
>>>>> and if I hit one bad record the whole job fails. How can I trap and
>>>>> log errors and continue?
>>>>>
>>>>>
>>>>> Vince Clark
>>>>> [hidden email]
>>>>> (303) 493-6723
>>>>>
>>>>
>>>> --
>>>> BJ Freeman
>>>> http://www.businessesnetwork.com/automation
>>>> http://bjfreeman.elance.com
>>>> http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
>>>>
>>>>
>>>> Systems Integrator.
>>>>
>>>
>>>
>>
>> --
>> BJ Freeman
>> http://www.businessesnetwork.com/automation
>> http://bjfreeman.elance.com
>> http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
>>
>> Systems Integrator.
>>
>
>

--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.