Setting up the application to use ActivitySessions

When the application is using ActivitySessions, the ActivitySession performs the session management.

To manage sessions using ActivitySessions, set up the ActivitySession with the WebSphere(R) Application Server Toolkit:

  1. If the application is using ActivitySessions in automatic mode, modify the following settings for the EJBs and servlets:
    EJB settings:
    • Transaction Type: Container
    • Local Transaction Boundry: ActivitySession
    • Resolve Control: Container
    • Container Transactions: Not Supported
    • ActivitySession ControlKind: select one of the following according to your need:
      • Mandatory
      • Requires new
      • Required
      • Support
    Servlet settings:
    • ActivitySession ControlKind: Container

    For information on these settings, refer to the WebSphere Business Integration Server Foundation documentation.

    The ActivitySession starts when the HTTPSession starts and ends when the HTTPSession ends. The application does not need to do anything.

  2. If the application is using ActivitySessions in user-defined mode, modify the following settings for the EJBs and servlets:
    EJB settings:
    • Transaction Type: Container
    • Local Transaction Boundry: ActivitySession
    • Resolve Control: Container
    • Container Transactions: Not Supported
    • Container ActivitySession: Support
    • ActivitySession ControlKind: select one of the following according to your need:
      • Mandatory
      • Requires new
      • Required
      • Support
    Servlet settings:
    • ActivitySession ControlKind: WebApp

    For information on these settings, refer to the WebSphere Business Integration Server Foundation documentation.

  3. Create the session management configuration file (bttsm.properties), enable the ActivitySession (enabled=true) and define which operations start and stop the SingleActivitySession:
    enabled = true;
    [LocalTransaction1]
    op1=beginOp
    op2=EndOp
    [LocalTransaction2]
    op3=beginOp
    op4=endOp
  4. Invoke the various methods in the ActivitySession (which contains all of the current sessions) or SingleActivitySession, which represents a session instance. For example, use ActivitySession.getInstance().getSession(sessionId) to get the SingleActivitySession associated with the HTTPSession. Use the beginSession and endSession methods in SingleActivitySession to manage the session instance.
Note: You must also define EnableActivitySession=true in the bttsm.properties file to enable the ActivitySession for toolkit applications.