public interface Session
Session represents user’s subscription to a set of topics. This set is immutable, so new session should be created if user wants to add/remove subscriptions to some topics.
Session does multiplexing for messages from several topics, so that only a single client connection is required to for data transfer.
When session is created, it is getting unique UUID identifier, that client uses to communicate to that session.
When client is subscribed to a set of topics associated with some session, session fires SessionPreSubscriptionEvent, so that application developer can control subscriptions according to access rights.
Session is kept alive for (getMaxInactiveInterval()
) minutes since the last time it has been accessed. Note that push can work in either polling (long
polling) and persistent connection (WebSocket) modes, so session should be kept-alive correctly in both cases.
Modifier and Type | Method and Description |
---|---|
void |
clearBroadcastedMessages(long sequenceNumber)
Clears all the queues messages associated with this session that has sequence number lower than provided number
|
void |
connect(Request request)
Connects given request to this session
|
void |
disconnect()
Releases/disconnects associated request from this session
|
Map<TopicKey,String> |
getFailedSubscriptions()
Get a map of topic keys this session failed to be subscribed to including the message why the subscription failed
|
String |
getId()
Returns unique identifier of this session.
|
long |
getLastAccessedTime()
Returns the last time when the session was accessed
|
int |
getMaxInactiveInterval()
How much minutes is session kept alive since the last time it has been accessed before it is destroyed
|
Collection<MessageData> |
getMessages()
Returns list of messages associated with this push session
|
Collection<TopicKey> |
getSuccessfulSubscriptions()
Get a list of topic keys this session is successfully subscribed to
|
void |
invalidate()
Invalidates this session, making it non-active
|
void |
push(TopicKey topicKey,
String serializedData)
Pushes given data to given topic key
|
void |
subscribe(String[] topics)
Subscribe this session to given topics
|
String getId()
int getMaxInactiveInterval()
long getLastAccessedTime()
Collection<TopicKey> getSuccessfulSubscriptions()
Map<TopicKey,String> getFailedSubscriptions()
void subscribe(String[] topics)
void connect(Request request) throws Exception
Exception
void disconnect() throws Exception
Exception
void invalidate()
Collection<MessageData> getMessages()
void clearBroadcastedMessages(long sequenceNumber)
Copyright © 2015 JBoss by Red Hat. All Rights Reserved.