public class Session extends java.lang.Object implements ISession, ITransportHandler
ISession.OnConnectListener, ISession.OnDisconnectListener, ISession.OnJoinListener, ISession.OnLeaveListener, ISession.OnReadyListener, ISession.OnUserErrorListener| Constructor and Description |
|---|
Session() |
Session(java.util.concurrent.ExecutorService executor) |
| Modifier and Type | Method and Description |
|---|---|
ISession.OnConnectListener |
addOnConnectListener(ISession.OnConnectListener listener) |
ISession.OnDisconnectListener |
addOnDisconnectListener(ISession.OnDisconnectListener listener) |
ISession.OnJoinListener |
addOnJoinListener(ISession.OnJoinListener listener) |
ISession.OnLeaveListener |
addOnLeaveListener(ISession.OnLeaveListener listener) |
ISession.OnUserErrorListener |
addOnUserErrorListener(ISession.OnUserErrorListener listener) |
ISession.OnReadyListener |
adOnReadyListener(ISession.OnReadyListener listener) |
java.util.concurrent.CompletableFuture<CallResult> |
call(java.lang.String procedure,
java.util.List<java.lang.Object> args,
java.util.Map<java.lang.String,java.lang.Object> kwargs,
CallOptions options)
Call a remote procedure.
|
<T> java.util.concurrent.CompletableFuture<T> |
call(java.lang.String procedure,
java.util.List<java.lang.Object> args,
java.util.Map<java.lang.String,java.lang.Object> kwargs,
com.fasterxml.jackson.core.type.TypeReference<T> resultType,
CallOptions options)
Call a remote procedure where the result needs to be resolved to a
POJO.
|
<T> java.util.concurrent.CompletableFuture<T> |
call(java.lang.String procedure,
com.fasterxml.jackson.core.type.TypeReference<T> resultType,
CallOptions options,
java.lang.Object... args)
Call a remote procedure where the result needs to be resolved to a
POJO.
|
long |
getID()
Returns the ID of the current session, 0 otherwise.
|
boolean |
isConnected() |
java.util.concurrent.CompletableFuture<SessionDetails> |
join(java.lang.String realm,
java.util.List<java.lang.String> authMethods)
Join a realm on the WAMP router
|
void |
leave(java.lang.String reason,
java.lang.String message)
Leave the currently joined WAMP session.
|
void |
onConnect(ITransport transport,
ISerializer serializer) |
void |
onDisconnect(boolean wasClean) |
void |
onMessage(byte[] payload,
boolean isBinary) |
java.util.concurrent.CompletableFuture<Publication> |
publish(java.lang.String topic)
Publishes to a previously registered WAMP topic that takes no arguments.
|
java.util.concurrent.CompletableFuture<Publication> |
publish(java.lang.String topic,
java.util.List<java.lang.Object> args,
java.util.Map<java.lang.String,java.lang.Object> kwargs,
PublishOptions options)
Publishes to a previously registered WAMP topic
|
java.util.concurrent.CompletableFuture<Publication> |
publish(java.lang.String topic,
java.lang.Object... args)
Publishes to a previously registered WAMP topic that takes multiple
positional arguments.
|
java.util.concurrent.CompletableFuture<Publication> |
publish(java.lang.String topic,
java.lang.Object arg,
PublishOptions options)
Publishes to a previously registered WAMP topic that takes a single
argument.
|
java.util.concurrent.CompletableFuture<Publication> |
publish(java.lang.String topic,
PublishOptions options)
Publishes to a previously registered WAMP topic that takes no arguments.
|
java.util.concurrent.CompletableFuture<Publication> |
publish(java.lang.String topic,
PublishOptions options,
java.lang.Object... args)
Publishes to a previously registered WAMP topic that takes multiple
positional arguments.
|
<T> java.util.concurrent.CompletableFuture<Registration> |
register(java.lang.String procedure,
java.util.function.BiFunction<T,InvocationDetails,java.util.concurrent.CompletableFuture<InvocationResult>> endpoint,
RegisterOptions options)
Registers a WAMP procedure.
|
<T> java.util.concurrent.CompletableFuture<Registration> |
register(java.lang.String procedure,
java.util.function.Function<T,java.util.concurrent.CompletableFuture<InvocationResult>> endpoint,
RegisterOptions options)
Registers a WAMP procedure.
|
java.util.concurrent.CompletableFuture<Registration> |
register(java.lang.String procedure,
IInvocationHandler endpoint,
RegisterOptions options)
Registers a WAMP procedure.
|
java.util.concurrent.CompletableFuture<Registration> |
register(java.lang.String procedure,
java.util.function.Supplier endpoint,
RegisterOptions options)
Registers a WAMP procedure.
|
<T,U> java.util.concurrent.CompletableFuture<Registration> |
register(java.lang.String procedure,
TriFunction<T,U,InvocationDetails,java.util.concurrent.CompletableFuture<InvocationResult>> endpoint,
RegisterOptions options)
Registers a WAMP procedure.
|
void |
removeOnConnectListener(ISession.OnConnectListener listener) |
void |
removeOnDisconnectListener(ISession.OnDisconnectListener listener) |
void |
removeOnJoinListener(ISession.OnJoinListener listener) |
void |
removeOnLeaveListener(ISession.OnLeaveListener listener) |
void |
removeOnReadyListener(ISession.OnReadyListener listener) |
void |
removeOnUserErrorListener(ISession.OnUserErrorListener listener) |
<T> java.util.concurrent.CompletableFuture<Subscription> |
subscribe(java.lang.String topic,
java.util.function.BiConsumer<T,EventDetails> handler,
SubscribeOptions options)
Subscribes to a WAMP topic.
|
<T> java.util.concurrent.CompletableFuture<Subscription> |
subscribe(java.lang.String topic,
java.util.function.BiFunction<T,EventDetails,java.util.concurrent.CompletableFuture<ReceptionResult>> handler,
SubscribeOptions options)
Subscribes to a WAMP topic.
|
<T> java.util.concurrent.CompletableFuture<Subscription> |
subscribe(java.lang.String topic,
java.util.function.Consumer<T> handler,
SubscribeOptions options)
Subscribes to a WAMP topic
|
<T> java.util.concurrent.CompletableFuture<Subscription> |
subscribe(java.lang.String topic,
java.util.function.Function<T,java.util.concurrent.CompletableFuture<ReceptionResult>> handler,
SubscribeOptions options)
Subscribes to a WAMP topic.
|
<T,U> java.util.concurrent.CompletableFuture<Subscription> |
subscribe(java.lang.String topic,
TriConsumer<T,U,EventDetails> handler,
SubscribeOptions options)
Subscribes to a WAMP topic.
|
<T,U> java.util.concurrent.CompletableFuture<Subscription> |
subscribe(java.lang.String topic,
TriFunction<T,U,EventDetails,java.util.concurrent.CompletableFuture<ReceptionResult>> handler,
SubscribeOptions options)
Subscribes to a WAMP topic.
|
public Session()
public Session(java.util.concurrent.ExecutorService executor)
public long getID()
public void onConnect(ITransport transport, ISerializer serializer) throws java.lang.Exception
onConnect in interface ITransportHandlerjava.lang.Exceptionpublic void onMessage(byte[] payload,
boolean isBinary)
throws java.lang.Exception
onMessage in interface ITransportHandlerjava.lang.Exceptionpublic void onDisconnect(boolean wasClean)
onDisconnect in interface ITransportHandlerpublic boolean isConnected()
isConnected in interface ISessionisConnected in interface ITransportHandlerpublic <T> java.util.concurrent.CompletableFuture<Subscription> subscribe(java.lang.String topic, java.util.function.Consumer<T> handler, SubscribeOptions options)
subscribe in interface ISessiontopic - URI of the topic to subscribehandler - callback method for results of publication to the topic.options - options for the subscribeSubscriptionpublic <T> java.util.concurrent.CompletableFuture<Subscription> subscribe(java.lang.String topic, java.util.function.Function<T,java.util.concurrent.CompletableFuture<ReceptionResult>> handler, SubscribeOptions options)
subscribe in interface ISessiontopic - URI of the topic to subscribehandler - callback method for results of publication to the topic.options - options for the subscribeSubscriptionpublic <T> java.util.concurrent.CompletableFuture<Subscription> subscribe(java.lang.String topic, java.util.function.BiConsumer<T,EventDetails> handler, SubscribeOptions options)
subscribe in interface ISessiontopic - URI of the topic to subscribehandler - callback method for results of publication to the topic.options - options for the subscribeSubscriptionpublic <T> java.util.concurrent.CompletableFuture<Subscription> subscribe(java.lang.String topic, java.util.function.BiFunction<T,EventDetails,java.util.concurrent.CompletableFuture<ReceptionResult>> handler, SubscribeOptions options)
subscribe in interface ISessiontopic - URI of the topic to subscribehandler - callback method for results of publication to the topic.options - options for the subscribeSubscriptionpublic <T,U> java.util.concurrent.CompletableFuture<Subscription> subscribe(java.lang.String topic, TriConsumer<T,U,EventDetails> handler, SubscribeOptions options)
subscribe in interface ISessiontopic - URI of the topic to subscribehandler - callback method for results of publication to the topic.options - options for the subscribeSubscriptionpublic <T,U> java.util.concurrent.CompletableFuture<Subscription> subscribe(java.lang.String topic, TriFunction<T,U,EventDetails,java.util.concurrent.CompletableFuture<ReceptionResult>> handler, SubscribeOptions options)
subscribe in interface ISessiontopic - URI of the topic to subscribehandler - callback method for results of publication to the topic.options - options for the subscribeSubscriptionpublic java.util.concurrent.CompletableFuture<Publication> publish(java.lang.String topic, java.util.List<java.lang.Object> args, java.util.Map<java.lang.String,java.lang.Object> kwargs, PublishOptions options)
publish in interface ISessiontopic - URI of the topicargs - positional arguments for the topickwargs - keyword arguments for the topicoptions - options for the publicationPublicationpublic java.util.concurrent.CompletableFuture<Publication> publish(java.lang.String topic, java.lang.Object arg, PublishOptions options)
publish in interface ISessiontopic - URI of the topicarg - positional argument for the topicoptions - options for the publicationPublicationpublic java.util.concurrent.CompletableFuture<Publication> publish(java.lang.String topic, PublishOptions options, java.lang.Object... args)
publish in interface ISessiontopic - URI of the topicoptions - options for the publicationargs - positional arguments for the topicPublicationpublic java.util.concurrent.CompletableFuture<Publication> publish(java.lang.String topic, java.lang.Object... args)
publish in interface ISessiontopic - URI of the topicargs - positional arguments for the topicPublicationpublic java.util.concurrent.CompletableFuture<Publication> publish(java.lang.String topic, PublishOptions options)
publish in interface ISessiontopic - URI of the topicoptions - options for the publicationPublicationpublic java.util.concurrent.CompletableFuture<Publication> publish(java.lang.String topic)
publish in interface ISessiontopic - URI of the topicPublicationpublic java.util.concurrent.CompletableFuture<Registration> register(java.lang.String procedure, java.util.function.Supplier endpoint, RegisterOptions options)
register in interface ISessionprocedure - name of the procedureendpoint - the callee for the remote procedureoptions - options for the procedure registrationRegistrationpublic java.util.concurrent.CompletableFuture<Registration> register(java.lang.String procedure, IInvocationHandler endpoint, RegisterOptions options)
register in interface ISessionprocedure - name of the procedureendpoint - the callee for the remote procedureoptions - options for the procedure registrationRegistrationpublic <T> java.util.concurrent.CompletableFuture<Registration> register(java.lang.String procedure, java.util.function.Function<T,java.util.concurrent.CompletableFuture<InvocationResult>> endpoint, RegisterOptions options)
register in interface ISessionprocedure - name of the procedureendpoint - the callee for the remote procedureoptions - options for the procedure registrationRegistrationpublic <T> java.util.concurrent.CompletableFuture<Registration> register(java.lang.String procedure, java.util.function.BiFunction<T,InvocationDetails,java.util.concurrent.CompletableFuture<InvocationResult>> endpoint, RegisterOptions options)
register in interface ISessionprocedure - name of the procedureendpoint - the callee for the remote procedureoptions - options for the procedure registrationRegistrationpublic <T,U> java.util.concurrent.CompletableFuture<Registration> register(java.lang.String procedure, TriFunction<T,U,InvocationDetails,java.util.concurrent.CompletableFuture<InvocationResult>> endpoint, RegisterOptions options)
register in interface ISessionprocedure - name of the procedureendpoint - the callee for the remote procedureoptions - options for the procedure registrationRegistrationpublic java.util.concurrent.CompletableFuture<CallResult> call(java.lang.String procedure, java.util.List<java.lang.Object> args, java.util.Map<java.lang.String,java.lang.Object> kwargs, CallOptions options)
call in interface ISessionprocedure - URI of the procedure to callargs - positional arguments for the procedurekwargs - keyword arguments for the procedureoptions - options for the WAMP callCallResultpublic <T> java.util.concurrent.CompletableFuture<T> call(java.lang.String procedure,
java.util.List<java.lang.Object> args,
java.util.Map<java.lang.String,java.lang.Object> kwargs,
com.fasterxml.jackson.core.type.TypeReference<T> resultType,
CallOptions options)
call in interface ISessionprocedure - URI of the procedure to callargs - positional arguments for the procedurekwargs - keyword arguments for the procedureresultType - TypeReference encapsulating the class that the
returned CompletableFuture should resolve tooptions - options for the WAMP callpublic <T> java.util.concurrent.CompletableFuture<T> call(java.lang.String procedure,
com.fasterxml.jackson.core.type.TypeReference<T> resultType,
CallOptions options,
java.lang.Object... args)
call in interface ISessionprocedure - URI of the procedure to callresultType - TypeReference encapsulating the class that the
returned CompletableFuture should resolve tooptions - options for the WAMP callargs - positional arguments for the procedurepublic java.util.concurrent.CompletableFuture<SessionDetails> join(java.lang.String realm, java.util.List<java.lang.String> authMethods)
join in interface ISessionrealm - name of the realm to joinauthMethods - list of authentication methods to trySessionDetailspublic void leave(java.lang.String reason,
java.lang.String message)
public ISession.OnJoinListener addOnJoinListener(ISession.OnJoinListener listener)
public void removeOnJoinListener(ISession.OnJoinListener listener)
public ISession.OnReadyListener adOnReadyListener(ISession.OnReadyListener listener)
public void removeOnReadyListener(ISession.OnReadyListener listener)
public ISession.OnLeaveListener addOnLeaveListener(ISession.OnLeaveListener listener)
public void removeOnLeaveListener(ISession.OnLeaveListener listener)
public ISession.OnConnectListener addOnConnectListener(ISession.OnConnectListener listener)
public void removeOnConnectListener(ISession.OnConnectListener listener)
public ISession.OnDisconnectListener addOnDisconnectListener(ISession.OnDisconnectListener listener)
public void removeOnDisconnectListener(ISession.OnDisconnectListener listener)
public ISession.OnUserErrorListener addOnUserErrorListener(ISession.OnUserErrorListener listener)
public void removeOnUserErrorListener(ISession.OnUserErrorListener listener)