Use the ActivitySession service
We can implement WebSphere enterprise applications that use ActivitySessions. The ActivitySession service provides an alternative unit-of-work scope to the scope provided by global transaction contexts.
ActivitySessions provide a scoping mechanism for units of work, and both an ActivitySession and a transaction have the same following characteristics:
- They can be bean-managed or container-managed
- They can be distributed across application servers
- They can be used as the context for managing EJB activation policy and lifecycle
An ActivitySession differs significantly from a transaction in the way that it interacts with resource managers. An ActivitySession is used to scope or coordinate local transactions. That is, we can use an ActivitySession to request multiple one-phase resource managers to come to an application- or container-determined outcome. Unlike a transaction, an ActivitySession has no notion of a prepare phase or any notion of recovery at a service level.
The WebSphere EJB container and deployment tools support ActivitySessions as an extension to the Java platform for enterprise applications programming model. Enterprise beans can be deployed with life cycles that are influenced by ActivitySession context, as an alternative to transaction context. An enterprise bean with an ActivitySession-scoped lifecycle can participate in a resource manager local transaction (RMLT) that has a duration of the ActivitySession rather than an individual method on the bean (which is all that is possible under the standard Java platform for enterprise applications model). Applications can then be composed of several enterprise beans with ActivitySession-based activation, with each bean participating in extended local transactions with one or more resource managers. At the end of the ActivitySession, the ActivitySession manager can direct each of the local transactions to a common outcome.
We can configure the WebSphere containers and deployable applications to support enterprise beans that operate under application- or container-initiated ActivitySessions rather than, or in addition to, transactions.
To implement WebSphere enterprise applications that use ActivitySessions, use the following tasks.
- Develop an enterprise application to use ActivitySessions
- Develop an enterprise bean or enterprise application client to manage ActivitySessions
- Set EJB module ActivitySession deployment attributes
- Enable or disable the ActivitySession service
- Configure the default ActivitySession timeout for an application server
Related concepts
ActivitySession and transaction contexts ActivitySession samples
Usage model for using ActivitySessions with HTTP sessions