Interface AsyncEndpointClientSpi
-
public interface AsyncEndpointClientSpiSPI of the client endpoint using an asynchronous network protocol.You must provide an implementation of this interface if you plan to use a full duplex communication protocol, such as Web Sockets for example.
This endpoint interacts locally with a
AsyncNodeClientnode and remotely with aAsyncEndpointServerSpiendpoint.- Since:
- 2.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcloseSession(java.lang.String sessionId)Invoked by theAsyncNodeClientnode to close a communication session with the server identified by the provided sessionId.
Following the closing of the session you must : Unregister the session associated to the provided sessionId.voidopenSession(java.lang.String sessionId)Invoked by theAsyncNodeClientnode to open a communication session with the server.voidsendMessage(MessageDto message)Invoked by theAsyncNodeClientnode to send aMessageDtoto the server.
You have to : Find the opened session using the accessible sessionId value using the methodMessageDto.getSessionId()on the provided message to send.
-
-
-
Method Detail
-
openSession
void openSession(java.lang.String sessionId)
Invoked by theAsyncNodeClientnode to open a communication session with the server.
Following the opening of the session you must :- Associate the session with the provided sessionId in order to be able to retrieve the session later.
- Retrieve the
AsyncNodeClientnode using the getAsyncNode() method of the associated distributed component, depending on your use case. - Invoke the method
AsyncNodeClient.onOpen(String)on the node.
- Parameters:
sessionId- The session id.- Since:
- 2.0.0
-
sendMessage
void sendMessage(MessageDto message)
Invoked by theAsyncNodeClientnode to send aMessageDtoto the server.
You have to :- Find the opened session using the accessible sessionId value using the method
MessageDto.getSessionId()on the provided message to send. - Serialize and send the
MessageDtoto the server.
- Parameters:
message- The message to send.- Since:
- 2.0.0
- Find the opened session using the accessible sessionId value using the method
-
closeSession
void closeSession(java.lang.String sessionId)
Invoked by theAsyncNodeClientnode to close a communication session with the server identified by the provided sessionId.
Following the closing of the session you must :- Unregister the session associated to the provided sessionId.
- Retrieve the
AsyncNodeClientnode using the getAsyncNode() method of the associated distributed component, depending on your use case. - Call the method
AsyncNodeClient.onClose(String)on the node.
- Parameters:
sessionId- The session id.- Since:
- 2.0.0
-
-