Documentation

Documentation versions (currently viewingVaadin 24)

Kubernetes Kit Session Replication

Best practices to achieve session replication when using Kubernetes Kit.

Kubernetes Kit allows session replication by transferring HTTP session data via a backend session storage for every request. This requires that everything stored in the session is made serializable. The Kubernetes Kit documentation provides some general session replication tips. However, when using Collaboration Kit, there are some specific changes you may need to make.

Collaboration Kit Classes

An instance of the class CollaborationEngine should not be stored in the session. Don’t work directly with the CollaborationEngine class. Instead, utilize other APIs, such as Topic, CollaborationBinder and the managers. If you must work directly with the class, it should always be accessed using its singleton method:

ComponentConnectionContext context = new ComponentConnectionContext(
        this);

// In this case the CollaborationEngine instance
// also needs to be supplied.
messageManager = new MessageManager(context, localUser, topicId,
        CollaborationEngine::getInstance);

registration = CollaborationEngine.getInstance().openTopicConnection(context, topicId,
        localUser, connectionActivationCallback);
Note
The MessageManager constructor now takes a static method reference as its last argument. Previously, this took an instance of CollaborationEngine. This version of the constructor has now been deprecated, so you should also update this in your code.

Here is a list of other Collaboration Kit classes that should not be stored in the session:

Class Alternative

CollaborationList

Use topic.getNamedList()

CollaborationMap

Use topic.getNamedMap()

TopicConnection

Use CollaborationEngine.getInstance().openTopicConnection()

Conversely, here is a list of Collaboration Kit classes that are serializable and can be stored in the session:

Class

CollaborationAvatarGroup

CollaborationBinder

CollaborationMessage

CollaborationMessageInput

CollaborationMessageList

ComponentConnectionContext

FormManager

MessageManager

PresenceManager

SystemConnectionContext