Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For users who aren't familiar with the conversation concepts provided by MyFaces Orchestra:
Orchestra allows to group beans within a (named) conversation. Furthermore, it's possible to use beans with different (conversation-) lifecycles in the same page. (Usually there isn't one big conversation - like the std. CDI conversation which is more like a bit smarter session for a window/tab.) Conversations are bound to a window/tab of a browser. That means you automatically get new conversations, if you open the application in a new tab/window. Conversations are started automatically as soon terminates as a conversation scoped bean is used. A conversation ends terminates based on a timeout (in case of the access scope - a conversation ends terminates as soon as it wasn't used by a page). Furthermore, it's possible to end close (or restart) conversations manually. That means via an API call it's possible to end terminate a conversation immediately. The next access leads to a new conversation. If the whole session gets destroyed, also all conversations will be destroyed automatically.

...

Code Block
titleInjecting the current Conversation
borderStylesolid
@ConversationScoped
public class DemoBean3 implements Serializable
{
  @Inject
  private Conversation conversation;

  public void save()
  {
    //your custom logic
    //...

    this.conversation.endclose();

    //or use:
    //conversation.restart();
    //... if you know that you will need new instances of the same beans e.g. in the next view
    //#restart it's just a possible performance improvement
  }
}

If you don't like to end close a conversation immediately, you will be able to end terminate a conversation after the rendering process of the next view. This feature will be implemented soon. Currently you can use phase-observer-methods in combination with @View to do it manually.

...

Code Block
titleUsage of @ConversationGroup
borderStylesolid
@ConversationScoped
@ConversationGroup(ConversationGroup1.class)
public class DemoBean6 implements Serializable
{
    @Inject
    private Conversation conversation;

    public void save()
    {
      //...

      this.conversation.endclose();
    }
}
Code Block
titleImplementation of ConversationGroup1
borderStylesolid
public interface ConversationGroup1
{
}

...

Note
titleBe Careful

In case of this.conversation.endclose(); the whole conversation of ConversationGroup1 will be destroyed (in this case 2 beans).

If you would like to end close all conversations of an other conversation-group, you can use the WindowContext.

Code Block
titleEnd Close a whole conversation group
borderStylesolid
public class DemoBean8
{
    @Inject
    private WindowContext windowContext;

    public void save()
    {
      //...

      this.windowContext.endConversationGroupcloseConversationGroup(ConversationGroup2.class);
    }
}