p2p::RoutingRules¶
-
class
kanzi::connect::p2p
::
RoutingRules
¶ Entity that manages messge routing rules for a single service instance.
Public Functions
-
RoutingRules
(const string &xml, const string interfacename = "", bool verboseLogging = false)¶ Constructor.
- Parameters
xml
: The XML document describing the routing.interfacename
: The name of the interface.
-
~RoutingRules
()¶ Destructor.
Inserts an endpoint to list of endpoints.
- Parameters
ep
: the endpoint to insert.
-
bool
addRoute
(const string &xml)¶ Add new route.
- Return
True if route was added successfully
- Parameters
xml
: Contains the route definition in xml
-
EndpointIterator
beginEndpoints
()¶ Get iterator to beginning of endpoints.
- Return
iterator
-
void
clearEndpoints
()¶ Clears all existing endpoints.
-
vector<shared_ptr<RoutingRules::Endpoint>>
collectRequiredEndpoints
(const string &reliableBearer, const string &unreliableBearer)¶ Used on service side where routing rules are analyzed and then a list of required endpoints is collected.
- Return
vector of endpoints required.
- Parameters
reliableBearer
: name of the reliable bearerunreliableBearer
: name of the unreliable bearer
-
EndpointIterator
endEndpoints
()¶ Get iterator to end of endpoints.
- Return
iterator
-
int
getMetaDataInt
(const string &name, int def = -1)¶ return integer from metadata
- Return
retrieved value.
- Parameters
name
: the name of the meta element to retrievedef
: default value to return if not found
-
string
getMetaDataString
(const string &name)¶ return stringfrom metadata
- Return
retrieved value. empty string if not found.
- Parameters
name
: the name of the meta element to retrieve
-
bool
isEmpty
() const¶ Is the object empty i.e.
no routing information included
- Return
true if empty.
-
bool
removeRouteForRuntimeData
()¶ Remove route for runtime data.
- Return
True if removed successfully, false if not found
-
bool
removeRouteForSubject
(const string &subjectName)¶ Remove route for given subject.
- Return
True if removed successfully, false if not found
- Parameters
subjectName
: Name of the method or event identifying the route to remove
-
bool
requireDirectLink
() const¶ Does any of the referred routing rules require direct link(s) or is this service server only.
- Return
true if direct link might be required.
-
RouteSharedPtr
routeForEvent
(const string &eventName)¶ Returns a preferred route for a specific event.
- Return
The route to apply.
- Parameters
eventName
: The name of the event to ask.
-
RouteSharedPtr
routeForEventMessage
(const string &eventMessageName)¶ Returns a preferred route for a specific event.
- Return
The route to apply.
- Parameters
eventMessageName
: The name of the event message to ask.
-
RouteSharedPtr
routeForMethod
(const string &methodName)¶ Returns a preferred route for a specific method.
- Return
The route to apply.
- Parameters
methodName
: The name of the method to ask.
-
RouteSharedPtr
routeForMethodMessage
(const string &methodMessageName)¶ Returns a preferred route for a specific method.
- Return
The route to apply.
- Parameters
methodMessageName
: The name of the method message to ask.
-
RouteSharedPtr
routeForRuntimeData
()¶ Returns a preferred route for a runtime data.
- Return
The route to apply.
-
string
toXml
(RouteAttributes *metadata = nullptr)¶ Converts the routing information to XML.
- Return
the xml representation of the routing information.
- Parameters
metadata
: Optional meta information put into the XML document. Name-value pairs.
-
class
Endpoint
¶ Endpoint for communication.
Public Types
-
typedef RouteAttributes::iterator
AttributeIterator
¶
Public Functions
-
Endpoint
()¶ Constructor.
-
AttributeIterator
beginAttributes
()¶ Return beginning of attributes.
- Return
iterator to beginning of attributes
-
AttributeIterator
endAttributes
()¶ Return end of attributes iterator.
- Return
iterator to end of attributes
-
bool
equals
(const Endpoint &o) const¶ Compares this and passed object by all information.
- Return
true if equals
- Parameters
o
: the object to compare to
-
bool
equalsByAddress
(const Endpoint &o) const¶ Compares this and passed object by address information.
- Return
true if equals by address
- Parameters
o
: object to compare to
-
bool
equalsByAddressAndReliability
(const Endpoint &o) const¶ Compares this and passed object by address and relialibility information.
- Return
true if equals by address
- Parameters
o
: object to compare to
-
const RouteAttributes &
getAttributes
() const¶ Retrieve attribute references.
- Return
reference to attribute container
-
const string &
getBearer
() const¶ Getter for bearer information.
- Return
the bearer information
-
const string &
getConnectIdentifier
() const¶ Retrieve previously set connect identifier.
- Return
connectIdentifier value.
-
const string &
getIdentifier
() const¶ Retrieves then endpoint identifier.
- Return
endpoint identifier
-
const string &
getIP
() const¶ Getter for IP Address.
- Return
IP Address
-
MessageDispatcher *
getMessageDispatcher
() const¶ Getter for message dispatcher.
- Return
message dispatcher
-
const string &
getPort
() const¶ Getter for port information.
- Return
port number
-
bool
getReliable
() const¶ Getter for reliable.
- Return
true if reliable.
-
bool
getUnreliable
() const¶ Getter for unreliable flag.
- Return
true if unreliable
-
void
setAttributes
(const RouteAttributes &attributes)¶ Stores the attributes specific for the route.
- Parameters
attributes
: the attributes
-
void
setBearer
(const string &bearer)¶ Setter for bearer information.
- Parameters
bearer
: the bearer to set
-
void
setConnectIdentifier
(const string &connectIdentifier)¶ Sets the connection identifier.
- Parameters
connectIdentifier
: some identifier using which the client can reach this service with selected bearer.
-
void
setIdentifier
(const string &identifier)¶ sets the endpoint identifier
- Parameters
identifier
: the name of the endpoint
-
void
setIP
(const string &ip)¶ Setter for IP Address.
For server side IP defines the interface to bind into.
- Parameters
ip
: the ip address
-
void
setMessageDispatcher
(MessageDispatcher *dsp)¶ Attach message dispatcher.
- Parameters
dsp
: the dispatcher to attach
-
void
setPort
(const string &port)¶ Setter for port information.
- Parameters
port
: the port information to set in string format
-
void
setPort
(int port)¶ Setter for port information.
- Parameters
port
: the port information
-
void
setReliable
(bool reliable)¶ Setter for reliable flag.
- Parameters
reliable
: state of the endpoint
-
void
setUnreliable
(bool unreliable = true)¶ Setter for unreliable flag.
- Parameters
unreliable
: unreliability state of the endpoint
-
string
toString
() const¶ Get stringular representation of the endpoint.
- Return
stringified representation of the object
-
bool
valid
() const¶ Checks is object valid.
- Return
true if valid.
-
typedef RouteAttributes::iterator
-
class
Route
¶ Defines a route for a single communications element.
Public Types
-
typedef RouteAttributes::iterator
AttributeIterator
¶
Public Functions
-
AttributeIterator
beginAttributes
()¶ Return beginning of attributes.
- Return
iterator to beginning of attributes
-
bool
directRouteEnabled
() const¶ Is direct route enabled.
- Return
true if direct route enabled
-
bool
directRoutePossible
() const¶ Determines whether route is direct and it is possible.
- Return
true if direct route is possible
-
AttributeIterator
endAttributes
()¶ Return end of attributes iterator.
- Return
iterator to end of attributes
-
bool
equals
(const RoutingRules::Route &other) const¶ Compares routes.
- Return
true if routes equal.
- Parameters
other
: the other route to compare this object to
-
const RouteAttributes &
getAttributes
() const¶ Retrieve attribute references.
- Return
reference to attribute container
-
const string &
getBearer
() const¶ Retrieve bearer information.
- Return
bearer
-
const string &
getLink
() const¶ Getter for link information.
- Return
link information
-
bool
getReliable
() const¶
-
const string &
getSubject
() const¶ Getter for subject information.
- Return
subject information
-
bool
serverRouteEnabled
() const¶ Routing via server enabled.
- Return
true if route via server enabled.
-
void
setAttributes
(const RouteAttributes &attributes)¶ Stores the attributes specific for the route.
- Parameters
attributes
: the attributes
-
void
setBearer
(string bearer)¶ Stores bearer information.
- Parameters
bearer
: the bearer information
Setter for endpoint.
- Parameters
ep
: endpoint to store
-
void
setLink
(const string &link)¶ Setter for link.
- Parameters
link
: link informaiton
-
void
setReliable
(bool reliable)¶
-
void
setSubject
(const string &subject)¶ Setter for subject information.
- Parameters
subject
: subject information
-
typedef RouteAttributes::iterator
-