0 Replies Latest reply on Feb 11, 2009 10:47 AM by Murat HAZER

    ending conversation using seam api

    Murat HAZER Newbie

      Hi everyone,


        I have a series of wizard like pages which runs in conversation scope without any issue. Now with a new business requirement a need to run this series of pages without taking any user input, interaction. So following code implements the new requirement;


      public void renewProducts(List<Product> products){
           if(logger.isDebugEnabled()) logger.debug("renewing products {0}", products.size());
           for(Product product : products){
                 this.renewSingleProduct(product);
           }
      }
      
      public void renewSingleProduct(Product product) {
         Conversation conversation = Conversation.instance();          
         conversation.begin();
      
         if (conversation != null) {
           logger.info("Conversation.instance().isLongRunning() = "+conversation.isLongRunning());
           logger.info("Conversation.instance().getDescription() = "+conversation.getDescription());
           logger.info("Conversation.instance().getId() = "+ conversation.getId());
         }
         
         Customer customer = retrieveCustomer();
         Contexts.getConversationContext().set("customer", customer);          
                
         ProductController productController = (ProductController)Component.getInstance("productController",ScopeType.CONVERSATION, true);
         productController.chooseProduct(product);
      
         //calls to other seam scoped components
                     
         conversation.end(true);
      }



      i see the same conversationId in the renewSingleProduct(Product product) method despite of calling conversation.end(true) explicitly. if i call conversation.leave() instead of conversation.end(true) new conversation created but this time first conversation variables aren't disinjected, because of this first conversation variables are used with the second one. Should i clean the conversation scoped components manually or there is a better way?


      regards ....