You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Ga...@Lawson.com on 2005/08/08 22:43:42 UTC

Automatically retrying failed transactions

There are some cases where I would like to automatically retry a 
transaction. Specifically, if a database deadlock, network error, or other 
transient error occurs, I would like the system to automatically resubmit 
a request. Unfortunately, I don't see how to easily do this with JSF.  One 
naive implementation I tried was to put a filter that automatically loops 
on transient errors (some number of times). Unfortunately, I think the 
FacesContext has already been reset by this point so that the second 
request is essentially just a page refresh. Does anyone have any ideas on 
how to do this? I feel that a robust enterprise level application should 
support auto-retries so I'm a bit surprised if there isn't a relatively 
straightforward way to do this but I couldn't find anything by searching 
the newsgroups.

Re: Automatically retrying failed transactions

Posted by Ga...@Lawson.com.
To me, JSF is purely meant to create interfaces for the user.  Any 
business logic should reside in a separate component layer.

Not sure where anything i said contradicts that. I just want a way to 
re-submit a request. when a certain type of exception occurs The best way 
to do this is to re-submit failed requests at the highest level of the 
call stack.

There are multiple problems with the idea of just putting the retry in the 
business logic method

1) A single http request might require multiple business object requests. 
Having the full request be a conceptual transaction makes sense.
2) I would have to write separate retry logic (or maybe use some byte code 
injection) for every one of my methods
3) What if this is a remote object and it is unreachable...shouldn't I 
still be able to retry (this would allow for transparent fail-over)
4) When using ORM mappers like hibernate, it's natural to first fetch the 
objects and then call business object methods on them. When the 
transaction fails, I would need to do the fetch again. Yes, all my methods 
could take primary keys instead of objects and load them up but that is 
ugly.

I don't really understand the resistance here. There isn't a way to say, 
try this JSF request again?







Richard Wallace <rw...@thewallacepack.net> 
08/08/2005 02:52 PM
Please respond to
"MyFaces Discussion" <us...@myfaces.apache.org>


To
MyFaces Discussion <us...@myfaces.apache.org>
cc

Subject
Re: Automatically retrying failed transactions






I think the point that he was trying to make was that this isn't 
something that JSF is meant to handle.  The way I would handle something 
like this is to have my backing bean get a reference to some business 
logic object (living in Spring or some other container in the same JVM 
or on another machine) and have the business logic object make the 
multiple attempts to perform the transaction. 

To me, JSF is purely meant to create interfaces for the user.  Any 
business logic should reside in a separate component layer.

Just my 2 cents,
Rich

Gabe.Wolosin@Lawson.com wrote:

>
> Just to be clear this is *not *a jdbc/orm issue. I can retry a request 
> if I'm not using jsf. For example, I have an xml servlet layer which 
> works fine with a filter that retries. Furthermore, there could be 
> cases where a non-database issue requires a retry (maybe a network 
> issue with a remote resource).
>
> Does anyone have any ideas how to retry a request in jsf?
>
>
>
> *Dennis_Byrne@ak.blm.gov*
>
> 08/08/2005 01:58 PM
> Please respond to
> "MyFaces Discussion" <us...@myfaces.apache.org>
>
>
> 
> To
>                "MyFaces Discussion" <us...@myfaces.apache.org>
> cc
> 
> Subject
>                Re: Automatically retrying failed transactions
>
>
>
> 
>
>
>
>
>
>
> This is more of a JDBC/ORM issue. 
>
> You need a fishing pole to get the fish to your boat, you need a 
> skillet to get the fish to the dinner table.  There are tools to catch 
> and cook the fish, but not in Java land ;)
>
> Dennis Byrne





Re: Automatically retrying failed transactions

Posted by Richard Wallace <rw...@thewallacepack.net>.
I think the point that he was trying to make was that this isn't 
something that JSF is meant to handle.  The way I would handle something 
like this is to have my backing bean get a reference to some business 
logic object (living in Spring or some other container in the same JVM 
or on another machine) and have the business logic object make the 
multiple attempts to perform the transaction. 

To me, JSF is purely meant to create interfaces for the user.  Any 
business logic should reside in a separate component layer.

Just my 2 cents,
Rich

Gabe.Wolosin@Lawson.com wrote:

>
> Just to be clear this is *not *a jdbc/orm issue. I can retry a request 
> if I'm not using jsf. For example, I have an xml servlet layer which 
> works fine with a filter that retries. Furthermore, there could be 
> cases where a non-database issue requires a retry (maybe a network 
> issue with a remote resource).
>
> Does anyone have any ideas how to retry a request in jsf?
>
>
>
> *Dennis_Byrne@ak.blm.gov*
>
> 08/08/2005 01:58 PM
> Please respond to
> "MyFaces Discussion" <us...@myfaces.apache.org>
>
>
> 	
> To
> 	"MyFaces Discussion" <us...@myfaces.apache.org>
> cc
> 	
> Subject
> 	Re: Automatically retrying failed transactions
>
>
>
> 	
>
>
>
>
>
>
> This is more of a JDBC/ORM issue.  
>
> You need a fishing pole to get the fish to your boat, you need a 
> skillet to get the fish to the dinner table.  There are tools to catch 
> and cook the fish, but not in Java land ;)
>
> Dennis Byrne



Re: Automatically retrying failed transactions

Posted by Ga...@Lawson.com.
Just to be clear this is not a jdbc/orm issue. I can retry a request if 
I'm not using jsf. For example, I have an xml servlet layer which works 
fine with a filter that retries. Furthermore, there could be cases where a 
non-database issue requires a retry (maybe a network issue with a remote 
resource). 

Does anyone have any ideas how to retry a request in jsf?




Dennis_Byrne@ak.blm.gov 
08/08/2005 01:58 PM
Please respond to
"MyFaces Discussion" <us...@myfaces.apache.org>


To
"MyFaces Discussion" <us...@myfaces.apache.org>
cc

Subject
Re: Automatically retrying failed transactions







This is more of a JDBC/ORM issue.   

You need a fishing pole to get the fish to your boat, you need a skillet 
to get the fish to the dinner table.  There are tools to catch and cook 
the fish, but not in Java land ;) 

Dennis Byrne

Re: Automatically retrying failed transactions

Posted by De...@ak.blm.gov.
This is more of a JDBC/ORM issue. 

You need a fishing pole to get the fish to your boat, you need a skillet 
to get the fish to the dinner table.  There are tools to catch and cook 
the fish, but not in Java land ;)

Dennis Byrne