[jboss-user] [JBoss Seam] - Planning to remove @Begin(id=..)? Help Needed!

raffaele.camanzo do-not-reply at jboss.com
Tue Mar 27 08:40:23 EDT 2007


Hi all,

reading comments to JBSEAM-976 (http://jira.jboss.com/jira/browse/JBSEAM-976) I read this:

anonymous wrote : 
  | Gavin King [20/Mar/07 08:27 PM]
  | 
  | Anyway, now that we have the now < conversation > stuff in pages.xml, we should deprecate @Begin(id=....).
  | 

I had a look both at the current documentation and software provided (1.2.0PATCH1) and the roadmap to SEAM 1.3.0BETA1 and I did not find any (but if I'm wrong please tell me how) other thing which makes available such feature (<conversation-begin> seems not to support the id parameter and I did not find other stuff related to the pages.xml to handle it).

anonymous wrote : 
  | Gavin King [20/Mar/07 08:27 PM]
  | 
  | Right, its not a bug. You should not expect @Begin(join=true, id="#{..}") to do anything if there is an existing long-running conversation. That would be totally evil. You would be switching from one LRC to another.
  | 

What can I say.. Yes, I would be (and I can with the current Seam code) switching from one LRC to another, and I do not understand why this is evil, indeed, the conversation management of Seam actually detects for me if the user asks for a service he asked for before and automatically resumes the correct conversation and it's data. I cannot base my app on pageflow or navigation rules because I'm trying to provide a set of services to the end user collected in the same *workspace*. 

The workspace loads the modules at compile time through a configuration file and some rules, e.g. interfaces, the modules have to adhere to be plugged in the workspace, each module lives in its conversation; the navigation rules are trivial: when a user asks for a service.. do it (display the page -> open a tab.. the workspace looks like a desktop app (everything *se(a)ems* :) to be in the same page) with a list of the services available on the left and a working area on the right, arranged as a tabbed view to allow a fast switch between a service and another).

A service can have more than one instance (same service in more than a tab), this means that I have the same outcome, the same view-id but not the same conversation id.

Each service *needs* a top level long running conversation and cannot work with nested ones because the user can close a tab (end a conversation) and I need a way to remove a conversation without removing all the other conversations nested in it (because if a user asks for the remotion of one service he does not.. and all the others I opened after it).

Is this that evil? And if, why?

Now I would like to say something about the JBSEAM-976 rejection.

anonymous wrote : 
  | Shane Bryzak [20/Mar/07 08:14 PM]
  | 
  | The submitted test case does not start a new conversation. Besides, this feature is going to become deprecated in favour of the new natural conversation ids feature. 
  | 

If you say from the second call to the @Begin method.. yes, it's true, but it's not the reason of the submitted issue, indeed, from doc's 6.6:

anonymous wrote : Clearly, these example result in the same conversation id every time a particular hotel, blog or task is selected.
  | So what happens if a conversation with the same conversation id already exists when the new conversation begins?
  | Well, Seam detects the existing conversation and redirects to that conversation without running the
  | @Begin method again. This feature helps control the number of workspaces that are created when using workspace
  | management.

then I expect that the @Begin method will no more called after the first time (for the same conversation id), but since the 1.1.1GA it does.
I made some tests on it modifying a little the test case: I added another action and a "catchall" action in the pages.xml


  | <pages>
  | 	<page view-id="/*" action="#{sessionHandler.checkConversation}"></page>
  | </pages>
  | 

the checkConversation is trivial.. prints on the server the conversation status

  | 	public String checkConversation() {
  | 		String result = null;
  | 
  | 		Logger.getLogger(this.getClass()).info("<CHECK CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: " + (Conversation.instance().isLongRunning() ? "YES" : "NO"));
  | 		Logger.getLogger(this.getClass()).info("<CHECK CONVERSATION> IS THERE A NESTED CONVERSATION: " + (Conversation.instance().isNested() ? "YES" : "NO"));
  | 		Logger.getLogger(this.getClass()).info("<CHECK CONVERSATION> LONG RUNNING CONVERSATION ID IS: " + Conversation.instance().getId());
  | 		Logger.getLogger(this.getClass()).info("<CHECK CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: " + Conversation.instance().getViewId());
  | 		Logger.getLogger(this.getClass()).info("<CHECK CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: " + Conversation.instance().getDescription());
  | 		
  | 		return result;
  | 	}
  | 

and I checked the behaviour, these are the results:

when the app starts the catchall method prints out this:

  | 2007-03-27 10:56:13,868 INFO  [org.jboss.seam.contexts.Lifecycle] starting up: org.jboss.seam.security.identity
  | 2007-03-27 10:56:13,918 INFO  [org.jboss.seam.core.Pages] reading pages.xml
  | 2007-03-27 10:56:14,376 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: NO
  | 2007-03-27 10:56:14,376 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A NESTED CONVERSATION: NO
  | 2007-03-27 10:56:14,376 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION ID IS: 1
  | 2007-03-27 10:56:14,378 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: null
  | 2007-03-27 10:56:14,379 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: null
  | 
as expected a temporary conversation is created with id 1 and will not be promoted because there's no conversation to begin.

Case 1 - @Begin(id=#{param.conversationId})
This should cover the case described in the documentation:
anonymous wrote : Clearly, these example result in the same conversation id every time a particular hotel, blog or task is selected.
  | So what happens if a conversation with the same conversation id already exists when the new conversation begins?
  | Well, Seam detects the existing conversation and redirects to that conversation without running the
  | @Begin method again. This feature helps control the number of workspaces that are created when using workspace
  | management.
I read, but maybe I'm wrong, when the @Begin method is called more than once on the same id, Seam catches this situation, switches to the long running and does not execute the @Begin method again (but we know that the last is not true), anyway, what happens:

a) I call the @Begin method of the actionone and the catchall (plus the actionone prints) say:

  | 2007-03-27 10:57:14,509 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: NO
  | 2007-03-27 10:57:14,509 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A NESTED CONVERSATION: NO
  | 2007-03-27 10:57:14,509 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION ID IS: 2
  | 2007-03-27 10:57:14,509 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: null
  | 2007-03-27 10:57:14,509 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: null
  | 2007-03-27 10:57:14,558 INFO  [it.seam.testcase.ActionOne] <ACTIONONE> START CONVERSATION METHOD CALLED
  | 2007-03-27 10:57:14,558 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: NO
  | 2007-03-27 10:57:14,558 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> IS THERE A NESTED CONVERSATION: NO
  | 2007-03-27 10:57:14,558 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> LONG RUNNING CONVERSATION ID IS: actionone
  | 2007-03-27 10:57:14,558 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: null
  | 2007-03-27 10:57:14,558 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: null
  | 
Creating the temporary conversation with id actionone which will be promoted to a long running because we are starting a conversation

b) I call the @Begin method of the actionone again and the catchall says:

  | 2007-03-27 10:57:39,699 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: YES
  | 2007-03-27 10:57:39,699 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A NESTED CONVERSATION: NO
  | 2007-03-27 10:57:39,699 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION ID IS: actionone
  | 2007-03-27 10:57:39,699 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: /actionone.xhtml
  | 2007-03-27 10:57:39,699 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: null
  | 

great found and handled but...


  | 2007-03-27 10:45:45,441 DEBUG [org.jboss.seam.Component] done initializing: org.jboss.seam.core.events
  | 2007-03-27 10:45:45,441 DEBUG [org.jboss.seam.core.Events] Processing event:org.jboss.seam.postSetVariable.actionOne
  | 2007-03-27 10:45:45,442 ERROR [org.jboss.seam.jsf.SeamPhaseListener] uncaught exception
  | javax.faces.el.EvaluationException: Exception while invoking expression #{actionOne.startConversation}
  |         at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
  |         at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
  |         at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
  |         at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:106)
  |         at org.jboss.seam.core.Pages.callAction(Pages.java:466)
  |         at org.jboss.seam.core.Pages.enterPage(Pages.java:275)
  |         
  |         
  |         ....
  |         
  | Caused by: java.lang.IllegalStateException: begin method invoked from a long running conversation, try using @Begin(join=true) on method: start
  | Conversation
  |         at org.jboss.seam.interceptors.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:45)
  |         at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
  |         at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
  |         at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
  | 

The programmer did not specify to join them and they did not join.. debug window, then, either I did not understand what's written in 6.6 or the doc is not complete because it does not work without a join.


Case 2 - @Begin(join=true, id=#{param.conversationId})

a) I call the @Begin method of the actionone and the catchall (plus the actionone prints) say:


  | 007-03-27 10:49:08,939 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: NO
  | 007-03-27 10:49:08,939 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A NESTED CONVERSATION: NO
  | 007-03-27 10:49:08,939 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION ID IS: 2
  | 007-03-27 10:49:08,939 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: null
  | 007-03-27 10:49:08,939 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: null
  | 007-03-27 10:49:08,991 INFO  [it.seam.testcase.ActionOne] <ACTIONONE> START CONVERSATION METHOD CALLED
  | 007-03-27 10:49:08,992 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: NO
  | 007-03-27 10:49:08,992 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> IS THERE A NESTED CONVERSATION: NO
  | 007-03-27 10:49:08,992 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> LONG RUNNING CONVERSATION ID IS: actionone
  | 007-03-27 10:49:08,992 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: null
  | 007-03-27 10:49:08,992 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: null
  | 

Creating the temporary conversation with id actionone which will be promoted to a long running because we are starting a conversation.

b) I call the @Begin method of the actiontwo and the catchall (plus the actiontwo prints) say:


  | 007-03-27 10:49:19,257 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: NO
  | 007-03-27 10:49:19,257 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A NESTED CONVERSATION: NO
  | 007-03-27 10:49:19,257 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION ID IS: 3
  | n007-03-27 10:49:19,257 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: null
  | 007-03-27 10:49:19,257 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: null
  | 007-03-27 10:49:19,279 INFO  [it.seam.testcase.ActionTwo] <ACTIONTWO> START CONVERSATION METHOD CALLED
  | 007-03-27 10:49:19,279 INFO  [it.seam.testcase.ActionTwo] <START CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: NO
  | 007-03-27 10:49:19,279 INFO  [it.seam.testcase.ActionTwo] <START CONVERSATION> IS THERE A NESTED CONVERSATION: NO
  | 007-03-27 10:49:19,279 INFO  [it.seam.testcase.ActionTwo] <START CONVERSATION> LONG RUNNING CONVERSATION ID IS: actiontwo
  | 007-03-27 10:49:19,279 INFO  [it.seam.testcase.ActionTwo] <START CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: null
  | 007-03-27 10:49:19,279 INFO  [it.seam.testcase.ActionTwo] <START CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: null
  | 

Creating the temporary conversation with id actiontwo which will be promoted to a long running because we are starting a conversation.

c) I call the @Begin method of the actionone again and the catchall (plus the actionone prints) say:


  | 007-03-27 10:49:27,811 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: YES
  | 007-03-27 10:49:27,811 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A NESTED CONVERSATION: NO
  | 007-03-27 10:49:27,811 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION ID IS: actionone
  | 007-03-27 10:49:27,811 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: /actionone.xhtml
  | 007-03-27 10:49:27,811 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: null
  | 007-03-27 10:49:27,812 INFO  [it.seam.testcase.ActionOne] <ACTIONONE> START CONVERSATION METHOD CALLED
  | 007-03-27 10:49:27,812 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: YES
  | 007-03-27 10:49:27,812 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> IS THERE A NESTED CONVERSATION: NO
  | 007-03-27 10:49:27,812 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> LONG RUNNING CONVERSATION ID IS: actionone
  | 007-03-27 10:49:27,812 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: /actionone.xhtml
  | 007-03-27 10:49:27,812 INFO  [it.seam.testcase.ActionOne] <START CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: null
  | 

Found actionone conversation and switched to (everything handled).

d) I call the @Begin method of the actiontwo again and the catchall (plus the actiontwo prints) say:


  | 007-03-27 10:49:38,523 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: YES
  | 007-03-27 10:49:38,523 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> IS THERE A NESTED CONVERSATION: NO
  | 007-03-27 10:49:38,523 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION ID IS: actiontwo
  | 007-03-27 10:49:38,523 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: /actiontwo.xhtml
  | 007-03-27 10:49:38,523 INFO  [it.seam.testcase.SessionHandler] <CHECK CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: null
  | 007-03-27 10:49:38,523 INFO  [it.seam.testcase.ActionTwo] <ACTIONTWO> START CONVERSATION METHOD CALLED
  | 007-03-27 10:49:38,523 INFO  [it.seam.testcase.ActionTwo] <START CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: YES
  | 007-03-27 10:49:38,523 INFO  [it.seam.testcase.ActionTwo] <START CONVERSATION> IS THERE A NESTED CONVERSATION: NO
  | 007-03-27 10:49:38,523 INFO  [it.seam.testcase.ActionTwo] <START CONVERSATION> LONG RUNNING CONVERSATION ID IS: actiontwo
  | 007-03-27 10:49:38,523 INFO  [it.seam.testcase.ActionTwo] <START CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: /actiontwo.xhtml
  | 007-03-27 10:49:38,523 INFO  [it.seam.testcase.ActionTwo] <START CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: null
  | 

Found actiontwo conversation and switched to (everything handled).

Everything seems to work properly except the reason of the issue JBSEAM-976, indeed the @Begin method is called more than once.

I tried also without ids in the @Begin, this causes the creation of a brand new conversation for every call to the @Begin method, but this is not enough for the app I'm building.


I don't know if you plan to remove the join=true related to a @Begin(id=...)  but please don't remove the explicit id facility, we wrote a lot of code based on this and the remotion causes the loss of a huge amount of time.


Regards,
Raffaele Camanzo



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032002#4032002

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032002



More information about the jboss-user mailing list