Kanzi Connect  3.9.8
Kanzi Connect C++ API
kanzi::connect::ExternalServiceSession Class Reference

External service session implementation. More...

#include <externalserviceadapter.hpp>

Inheritance diagram for kanzi::connect::ExternalServiceSession:
kanzi::connect::AbstractSession

Public Member Functions

 ExternalServiceSession (ExternalServiceAdapter &service, int clientId, int sessionId, MessageDispatcher *dispatcher, const string &instanceName)
 Constructor. More...
 
bool transmitToSession (const MessagePackage &message)
 Transmits a message to this session. More...
 
- Public Member Functions inherited from kanzi::connect::AbstractSession
 AbstractSession (const string &interfaceId, int clientId, int sessionId, MessageDispatcher *dispatcher)
 Constructor. More...
 
MessageSubscriptionToken addMessageSubscription (const string &messageType, MessageReceivedFunction function)
 Subscribe all messages of type. More...
 
MessageSubscriptionToken addMessageTypeSubscription (int messageType, MessageReceivedFunction function)
 Subscribe all messages of Message Package type. More...
 
MessageSubscriptionToken addRegexMessageSubscription (const string &regex, MessageReceivedFunction function)
 Subscribe all messages that match a regular expression. More...
 
void changeMessageDispatcher (MessageDispatcher *dispatcher)
 Changes message dispatcher on the fly. More...
 
void enableVerboseLogging (bool enable)
 Enables verbose logging for the functionality. More...
 
ClientDescriptorSharedPtr getClientDescriptor () const
 Retrieve client descriptor. More...
 
int getClientId () const
 Retrieve client id of the session. More...
 
int getId () const
 Retrieve id of the session. More...
 
const string & getInterfaceId () const
 Retrieve id of the interface. More...
 
int getServerClientId () const
 Retrieve server client identifier of the session. More...
 
const ServiceAttributesgetServiceAttributes ()
 
virtual void initialize ()
 Initializes this session. More...
 
void receive (const MessagePackage &message)
 Asks session to process received message. More...
 
void removeMessageSubscription (const string &messageType, MessageSubscriptionToken token)
 Remove message subscription. More...
 
void removeMessageTypeSubscription (int messageType, MessageSubscriptionToken token)
 Remove message subscription. More...
 
void removeRegexMessageSubscription (const string &regex, MessageSubscriptionToken token)
 Remove regular expression message subscription. More...
 
void setClientDescriptor (ClientDescriptorSharedPtr clientDescriptor)
 Saves a client descriptor of the client who created this session. More...
 
void setClientP2PRoutingInstructions (shared_ptr< p2p::P2PClient::RoutingHandler > routingHandler)
 Configure P2P routing instructions for the client. More...
 
void setGenericInvoker (GenericInvoker *invoker)
 Setups generic invocation mechanism. More...
 
void setServerClientId (int id)
 Sets servers identifier of the client this session belongs to. More...
 
void setServerP2PRouter (p2p::P2PServerSharedPtr serverRouter)
 Configure P2P routing for server scope. More...
 
void terminate ()
 Terminates the session. More...
 
bool transmit (const MessagePackage &message)
 Sends outgoing message to network. More...
 
bool transmit (MessagePackageSharedPtr message, uint32_t call_handle=0)
 Sends outgoing message to network. More...
 
virtual void uninitialize ()
 Un-initializes this session. More...
 
void updateEnabledState (bool newEnabledState)
 Update the enabled state of this session. More...
 
virtual ~AbstractSession ()
 Destructor. More...
 

Protected Member Functions

virtual shared_ptr< GenericRPCReplyMessage > onReceiveMessage (const MessagePackage &message)
 Allows derived class to receive notification of received message. More...
 
- Protected Member Functions inherited from kanzi::connect::AbstractSession
virtual void onTransmitMessage (const MessagePackage &message)
 Allows derived class to receive notification of transmitted message. More...
 

Additional Inherited Members

- Public Types inherited from kanzi::connect::AbstractSession
typedef function< bool(const MessagePackage &message)> MessageReceivedFunction
 Message subscription callback. More...
 
typedef shared_ptr< void > MessageSubscriptionToken
 
typedef unordered_map< string, string > ServiceAttributes
 

Detailed Description

External service session implementation.

Constructor & Destructor Documentation

◆ ExternalServiceSession()

kanzi::connect::ExternalServiceSession::ExternalServiceSession ( ExternalServiceAdapter service,
int  clientId,
int  sessionId,
MessageDispatcher dispatcher,
const string &  instanceName 
)

Constructor.

Parameters
servicethe service owning this session
clientIdthe client identifier/handle
sessionIdSession identifier/handle
instanceNamename of the instance.

Member Function Documentation

◆ onReceiveMessage()

virtual shared_ptr<GenericRPCReplyMessage> kanzi::connect::ExternalServiceSession::onReceiveMessage ( const MessagePackage message)
protectedvirtual

Allows derived class to receive notification of received message.

Parameters
messageMessage that was received.

Reimplemented from kanzi::connect::AbstractSession.

◆ transmitToSession()

bool kanzi::connect::ExternalServiceSession::transmitToSession ( const MessagePackage message)

Transmits a message to this session.

Parameters
messagethe message to transmit

The documentation for this class was generated from the following file: