Limitation: Only one GenericServiceClient instance per Client per Service is allowed. Having multiple instances of the class for same service and same network connection will not work properly.
More...
#include <genericserviceclient.hpp>
Limitation: Only one GenericServiceClient instance per Client per Service is allowed. Having multiple instances of the class for same service and same network connection will not work properly.
◆ EventCallbackFunction
typedef function<void(const string&, const map<string, string>&) kanzi::connect::GenericServiceClient::EventCallbackFunction) |
Signature of event callback function. All arguments converted to strings.
◆ EventCallbackRegistrationToken
Opaque token type for callback registration.
◆ EventRegistrationStateCallbackFunction
typedef function<void(const string&, EventRegistrationState) kanzi::connect::GenericServiceClient::EventRegistrationStateCallbackFunction) |
Function to be used to receive event registration state changes.
◆ DispatchResult
Method "dispatch to wire" result.
Enumerator |
---|
DispatchFailed | |
DispatchComplete | |
DispatchOngoing | |
◆ EventRegistrationState
Enumerates the event registration states.
Enumerator |
---|
EventRegistrationWaitingForService | Event registration is waiting for the corresponding service to become available.
|
EventRegistrationWaitingIntrospection | Event registration is waiting for service intropsection to complete.
|
EventRegistrationFailed | Event registration has failed. This is final status and re-registration is required to retry the operation.
|
EventRegistrationComplete | Event registration is complete and events should flow through.
|
◆ GenericServiceClient()
kanzi::connect::GenericServiceClient::GenericServiceClient |
( |
const string & | serviceName, |
|
|
ClientConnector & | clientConnector ) |
|
explicit |
Constructor.
- Parameters
-
serviceName | name of the service |
clientConnector | the client instance that should be used to communicate with the server. |
◆ ~GenericServiceClient()
kanzi::connect::GenericServiceClient::~GenericServiceClient |
( |
| ) |
|
◆ cleanEmptyItemsFromArray()
void kanzi::connect::GenericServiceClient::cleanEmptyItemsFromArray |
( |
vector< EventCallbackContextSharedPtr > & | arr | ) |
|
|
protected |
Cleans empty items from an array.
- Parameters
-
◆ composeAndDispatchMethod()
Composes final message and sends to towards the service.
- Parameters
-
method | Method invocation context |
signature | method signature |
mp | message package to hold physically "on wire" message. |
- Returns
- true if method was dispatched.
◆ create()
Factorize a generic service client to communicate with the specified service.
- Parameters
-
service | name of the service, E.g. Cluster |
cc | the clientconnector instance that should be used to communicate with the server. |
- Returns
- instance of GenericServiceClient
◆ createMethod()
MethodSharedPtr kanzi::connect::GenericServiceClient::createMethod |
( |
const string & | methodName | ) |
|
Creates a method for invocation.
- Parameters
-
methodName | name of the method |
- Returns
- Method instance
◆ getEventListenerRegistrationState()
Retrieve the state of event registration.
- Parameters
-
token | opaque token returned when registering started |
- Returns
- state that indicates whether registration is pending, failed or has it completed.
◆ getIntrospectionTimeout()
uint32_t kanzi::connect::GenericServiceClient::getIntrospectionTimeout |
( |
| ) |
const |
Retrieve currently configured introspection timeout value.
- Returns
- milliseconds
◆ getMethodIntrospectionXML()
const string & kanzi::connect::GenericServiceClient::getMethodIntrospectionXML |
( |
const string & | methodName | ) |
const |
Returns the cached introspection XML for a named method if such is available.
- Parameters
-
methodName | name of the method to retrieve introspections. |
- Returns
- XML in string format.
◆ handleServicePresenceChanged()
void kanzi::connect::GenericServiceClient::handleServicePresenceChanged |
( |
bool | present | ) |
|
|
protected |
Process service presence changes.
- Parameters
-
present | true should be passed when service becomes available, false if it disappears. |
◆ initialize()
void kanzi::connect::GenericServiceClient::initialize |
( |
| ) |
|
|
protected |
◆ invokeMethod()
Invokes a method within provided context.
- Parameters
-
method | the method invocation context |
route | describes where the invocation orignates from |
- Returns
- true if method invocation started.
◆ processIncomingEvent()
void kanzi::connect::GenericServiceClient::processIncomingEvent |
( |
const MessagePackage & | package, |
|
|
EventCallbackContextSharedPtr | context ) |
|
protected |
Processes an incoming message that will translate itself to an event.
- Parameters
-
package | the message package received |
context | the context describing the event. |
◆ registerEventListener()
Registers a event listener for a specific event.
- Parameters
-
eventName | name of the event to listen |
callback | function to invoke when event is received |
stateCallback | the state change callback that can be optionally listened to ensure event registrations is functional. If registration completes inline, then this callback is not invoked. Registration status can be explicitly queried with function getEventListenerRegistrationState |
- Returns
- opaque registration token that is used in unregistration.
◆ registerEventListenerEx()
Registers a event listener for a specific event.
- Parameters
-
eventName | the name of the event to listen |
callback | callback interface whom onEventReceived method is called when ever particular event is received |
- Returns
- opaque registration token that is used in unregistration.
◆ removeQueuedMethod()
bool kanzi::connect::GenericServiceClient::removeQueuedMethod |
( |
MethodSharedPtr | method | ) |
|
Removes possible queued method.
- Parameters
-
- Returns
- true if method was actually removed from the queue
◆ removeRunningMethod()
bool kanzi::connect::GenericServiceClient::removeRunningMethod |
( |
MethodSharedPtr | method | ) |
|
Remove a method from the ongoing list of methods.
This is mainly for internal use.
- Parameters
-
method | the method to remove |
- Returns
- true if method got removed.
◆ requestEventSignatureFromServer()
void kanzi::connect::GenericServiceClient::requestEventSignatureFromServer |
( |
EventCallbackContextSharedPtr | eventContext | ) |
|
|
protected |
Requests a event signature from the server.
Will populate information to attached object
- Parameters
-
eventContext | the context where the partial event information is and will thus be more populated. |
◆ serviceIsAvailable()
bool kanzi::connect::GenericServiceClient::serviceIsAvailable |
( |
| ) |
const |
Test whetner this particular service is available currently.
- Returns
- true if available.
◆ setIntrospectionTimeout()
void kanzi::connect::GenericServiceClient::setIntrospectionTimeout |
( |
uint32_t | milliseconds | ) |
|
Configures introspection timeout for method invocation.
- Parameters
-
milliseconds | amount of milliseconds the introspection can maximally take. Mimimum accepted value is 100, maximum is INT_MAX. |
◆ unregisterEventListener()
Unregisters event listener.
- Parameters
-
token | opaque token received during registration. |
◆ validateMethodSignature()
Validates that Method instance is properly setup and can be fired.
- Parameters
-
method | the method to be inspected |
signature | the method signature introspected from service |
mp | Message package where to all arguments are transfered. |
- Returns
- true if method object is considered valid.
◆ Method
The documentation for this class was generated from the following file:
- connect/genericserviceclient.hpp