Session Layer

The session layer is composed of SessionManager and Session interfaces.

Session

A session is responsible for processing protocol messages.

Sessions provide virtual operations that can be overridden in client adapters implementations. These operations are mainly:
  • enable: enable the session (for instance connect to a server) .

  • disable: disable the session (for instance disconnect from a server).

  • lock: lock the session (for instance block a socket).

  • unlock: unlock the session (for instance unblock a socket).

  • sendProtocolMessage: send a protocol message.

  • recvProtocolMessage: receive a protocol message.

package tcpca
{ 
        interface Session : provca::Session
        {
                [ virtual ]
                void enable();

                [ virtual ]
                void disable();

                [ virtual ]
                void lock();

                [ virtual ]
                void unlock();

                [ virtual ]
                void sendProtocolMessage(
                  in prov::ServiceOrder i_pm);

                [ virtual ]
                void recvProtocolMessage(
                  in prov::ServiceOrder i_pm);
        };
};

Sessions are instantiated and configured via the provca::Config::sessionFactoryName which must refer to an existing instance of provca::SessionFactory.

Specialized session factories can override an audit method auditing the new configuration parameters.

The lifecyle of Session objects is handled by the framework, so that users do not have to worry about when sessions have to be created and deleted but just how they should be created and deleted.

Sessions are instantiated when the client adapter is configured and deleted when the client adapter is reconfigured or deleted.

package tcpca
{ 
        interface SessionFactory : provca::SessionFactory
        {
                [ virtual ]
                void createSession(out provca::Session o_session);
[ virtual ]
                void deleteSession(inout provca::Session io_session);

                [ virtual ]
                void audit() raises (provca::OperationFailed);
        };
};

Session manager

Session manager:

  • A session manager manages sessions. It can work in two modes: ReserveOnGetSession and SkipReserve.

  • Session managers are instantiated and configured using a factory: SessionManagerFactory.

A session manager configured in the ReserveOnGetSession mode exclusively reserves a session when it is acquired using SessionManager::getSession. As a result, the session manager won't assign this session in another transaction until the session has properly been released. This mode is especially useful when the client adapter is used to act as a client with a send/recv (async) exchange schema to a system supporting a limiting number of clients.

A session manager configured in SkipReserve mode allows a session to process several protocol messages in parallel. In this mode, a SessionManager::getSession() call never fails unless the client adapter is disabled or locked. This mode is especially useful when the client adapter acts as a server.

There is one session manager and SessionManagerFactory::numberOfSessions sessions per client adapter.

These interfaces can be customized only through configuration, but if needed they can be redefined by inheritance.

For details of the SessionManager, Session, SessionManagerFactory and SessionFactory, refer to the component documentation for each of them.