17.6. Setting up the client persistence

Unlike in the case with services, the client persistence is set to level 1 by default. If you want to set it to the layer 2 (CPL-2), you must do so before the initial call to the endpoint’s connect method. The ClientEndpoint class has a method setPersistenceL2 to set CPL-2:

public void setPersistenceL2()

The storage file will be created in the directory where the Softnet library file “softnet.jar” is located. The platform uses the following scheme for naming client persistence storage files:

softnet.client.persistence_<serverAddress>_<clientKey>.scp

The platform takes the values of <serverAddress> and <clientKey> from the client URI provided to the endpoint, which has the following form:

<clientScheme>://<clientKey>@<serverAddress>

The second overload of the setPersistenceL2 method sets the persistence with a different location of the storage file:

public void setPersistenceL2(String fileBasedStorageDirectory)

There is a third overload of the setPersistenceL2 method designed to set a custom implementation of CPL-2:

public void setPersistenceL2(ClientPersistence clientPersistence)

This was the last of the sections on event persistence and quality of event delivery. The following sections of the chapter describe the technique for raising and handling service events.


TABLE OF CONTENTS