SessionService
import io.skipcheck.tm1.client.service.security.SessionService; Server sessions: every session logged in to the server (/Sessions), this one's
(ActiveSession), their users and threads, and closing another session.
To close this client's own session, close the Tm1Session or Tm1Client:
it sends ActiveSession/tm1.Close, and knows not to log in again. A closed
session stays listed in Sessions for a few seconds (5 to 9 in TM1 11.8).
List who's logged in, expanding each session's user:
// Every session on the server, with its user's name and its label
return tm1.sessions()
.list(ODataQuery.none()
.select(Session.ID, Session.CONTEXT)
.expand(Session.USER, user -> user.select(User.NAME)))
.map(session -> session.id() + " " + session.user().name() + " " + session.context());
Close other clients' sessions by their label, sparing this one:
// Close the sessions labelled "Nightly load", except this client's own
return tm1.sessions()
.activeSession(ODataQuery.none().select(Session.ID))
.map(Session::id)
.flatMapMany(own -> tm1.sessions()
.list(ODataQuery.none().select(Session.ID).filter(Session.CONTEXT.eq("Nightly load")))
.filter(session -> !own.equals(session.id())))
.flatMap(session -> tm1.sessions().close(session.id()))
.then();
Members
SessionService constructor | A service sending its requests through session. |
list | GET Sessions, streamed. |
get | GET Sessions(id). |
activeSession | This client's own session on the server. |
user | GET Sessions(id)/User. |
threads | GET Sessions(id)/Threads, streamed. |
close | Ends another session; its client must log in again. |
SessionService
constructorSessionService(Tm1Session session) A service sending its requests through session.
Parameters
session- the session
list
Flux<Session> list(ODataQuery query) GET Sessions, streamed: every session on the server, for an admin.
Parameters
query- what to select, expand (
User,Threads), filter and order
Returns
- the sessions
TM1 REST EntitySet Sessions
get
Mono<Session> get(long id, ODataQuery query) GET Sessions(id).
Parameters
id- the session's ID
query- what to select and expand
Returns
- the session, or a
Tm1NotFoundExceptionif there's none
TM1 REST EntitySet Sessions
activeSession
Mono<Session> activeSession(ODataQuery query) GET ActiveSession: this client's own session on the server.
Parameters
query- what to select and expand
Returns
- the session
TM1 REST Singleton ActiveSession
user
Mono<User> user(long id, ODataQuery query) GET Sessions(id)/User.
Parameters
id- the session's ID
query- what to select
Returns
- the session's user
TM1 REST Navigation Session/User
threads
Flux<Thread> threads(long id, ODataQuery query) GET Sessions(id)/Threads, streamed: what the session is running now.
Parameters
id- the session's ID
query- what to select, filter and order
Returns
- the session's threads
TM1 REST Navigation Session/Threads
close
Mono<Void> close(long id) tm1.Close: ends another session; its client must log in again. Needs schema
10.2.2.5.
Parameters
id- the session's ID
Returns
- completes when it's closed
TM1 REST Action Session/Close
Also in the Javadoc.