RemoteServiceHost¶
-
class
kanzi::connect
::
RemoteServiceHost
: public ServiceHost¶ A class that manages a service that is running remotely over the network.
Unnamed Group
-
string
getIdentifier
() const override¶ Retrieve interface identifier.
- Return
interface ID this service handles.
-
void
changeType
(const string &type) override¶ Changes the interface name at runtime.
- Parameters
type
: new type for the interface.
Initialize the service.
- Parameters
domain
: environment where the service is run in.contentClient
: access to content systemworkQueue
: interface to work queue used to dispatch work service is ready will eventually cause the services work() method to be invoked.
-
void
uninitialize
() override¶ cleanup the service.
Creates a session to this service.
- Return
session instance. ownership not transfered.
- Parameters
client
: identifies the client.sessionId
: identifies the session.
-
void
releaseSession
(int clientId, int sessionId) override¶ Releases a session.
- Parameters
clientId
: identifies the clientsessionId
: identifies the session
Routine that get(s) called periodically or especially when object itself has requested it to be called using the work queue.
- Parameters
workItem
: Item to be processed.
Invoked for each message this service should handle.
- Parameters
client
: identifies the message sendermessage
: the message to process.
-
void
notifyClientDisconnected
(int clientId) override¶ Invoked to inform that specific client has disconnected.
- Parameters
clientId
: Identifies the client.
-
const AbstractService::ServiceDescription &
getDescription
() override¶ Retrieve the service description from service host.
- Return
const reference to service description
-
const AbstractService::ServiceState &
getState
() override¶ Retrieve the service state information.
- Return
const reference to service state information.
-
bool
local
() const override¶ Is this service local or not.
- Return
true if service is local
-
shared_ptr<ServiceServiceConcept::Session>
getServiceSession
() const override¶ Returns a session to remote service.
Relevant only for remote services.
- Return
session
-
int
clientID
() const override¶ Returns the client identifier.
Relevant only for remote clients. Will return -1 for local clients.
- Return
client identifier.
-
AbstractServiceSharedPtr
getService
() const override¶ Returns a service instance.
Relevant only for local services.
- Return
service
-
int
countSessions
() const override¶ Returns amount of sessions towards this service.
- Return
amount of sessions
-
ClientDescriptorSharedPtr
getClientDescriptor
() override¶ Return the client descriptor.
Relevant only for remote services.
- Return
client descriptor
Stores service configuration properties.
Default implementation is empty, should be overridden by the remote service host implementation
- Parameters
properties
: data object describing the properties.
-
RuntimeDataObjectSharedPtr
getConfigurationProperties
() override¶ Retrieve service configuration properties.
- Return
properties as shared object.
-
void
setState
(const AbstractService::ServiceState &state) override¶ Sets the service state.
Relevant only for remote clients.
- Parameters
state
: new state for remote clients.
-
string
getServiceRoutingInformationDescription
(int serverclientid) override¶ Must be overridden by the corresponding implementation.
- Return
xml format routing information for the service.
-
bool
reportServiceRuntimeData
(const string &path, const string &stream) override¶ Can be called, mainly for remote services, to inform about new service information that was received.
-
void
notifyAll
(const MessagePackage &event) override¶ Internal API for scripting utilities makes assumptions on implementation details.
Do not use.
-
RuntimeDataObject *
getRuntimeData
() override¶ Internal API for scripting utilities makes assumptions on implementation details.
Do not use.
Public Functions
Constructor.
- Parameters
type
: the service interface identifierserviceSession
: pointer to session. Ownership does not transfer.
-
~RemoteServiceHost
() override¶ Destructor.
-
void
initializeFlowControl
(int credits, int creditreturninterval)¶ Initialize flow control object.
- Parameters
credits
: amount of credits initiallycreditreturninterval
: how often return credits to service.
-
bool
registerRoutingInformationSchema
(const string &schema)¶ Register routing information schema.
- Return
true if registration succeeds.
- Parameters
routing
: information schema to register.
-
bool
registerServiceDescriptionSchema
(const string &schema)¶ Invoked to register service description xml.
- Return
true if registration succeeded.
- Parameters
schema
: the schema (xml)
Sets a client descriptor.
- Parameters
clientDescription
: The information to set.
-
void
setDescription
(const AbstractService::ServiceDescription &description)¶ Set service description for a remote service.
- Parameters
description
: the description to set
-
string