2 Replies Latest reply on May 2, 2008 9:48 AM by gmkumar2005

    What is the right place to use Seam Conversations ?

    gmkumar2005

      Conversations is a central concept in Seam. Seam allows conversations on WEB Layer as well as at EJB Layer.
      My question is which layer is most appropriate place for hosting my conversations?
      If I restrict usage of conversational context to EJB layer what am i loosing?
      Hellow seam users How are u using conversations? and how is it working for you?



      What is the right place to use  Seam Conversations ?



      Important objectives of my application design are
      Promote re-usability of my business logic by supporting multiple presentation clients . Clients include A) JSF b) Local/Remote c) Standalone java clients d) Desktop application using web-services.

        • 1. Re: What is the right place to use Seam Conversations ?
          andygibson.contact.andygibson.net

          Conversations only really take place within the web context as a way to provide stateful interactions on an otherwise stateless infrastructure.


          A conversation is an object that is used to hold named objects between requests. In the JSF case, these objects are provided based on the name matching EL expressions using a JSF variable resolver.


          I could be wrong, but if you use standalone java clients interacting with remote ejbs, no conversation is needed because the client keeps hold of the conversational objects. One other problem you might face is not having Seam Transaction Management for non-JSF/Web Service bean access.


          I believe both JSF and Web services can use conversations as long as the Id is passed back and forth.


          Personally, I only use conversations in pages.xml since it decouples conversation management from my beans.


          In your case, since you have such varied uses for your beans, you may need to really consider the structure of your application carefully regarding conversations and also transactions. One other aspect of this is whether you clutter your beans with JSF backing bean code. You don't need your desktop clients calling your button click backing bean code in the same bean.


          Cheers,


          Andy Gibson

          • 2. Re: What is the right place to use Seam Conversations ?
            gmkumar2005

            Andy thanks a lot. You are correct conversation state is actually held by Seam in the servlet session between requests.
            You have clarified all my queries. I now understand that non-jsf clients will not need seam conversations. I like your idea of using pages.xml for demarcation of conversations.


            Cheers
            Kiran Kumar